Skip to main content

Just sharing this instructions in case it's useful for anyone else.

This should allow you to export directly from Gainsight to a spreadsheet using the Google Sheets API and external actions.

Once you have it set up you can schedule the rules as always and at least you should be able to avoid using the S3 bucket for this type of export. 

Some considerations:

  • There seems to be an intermittent issue with a call being lost on Gainsight’s side and support is investigating. So TEST IT A LOT! I will update when they find/fix the problem. I’ve tried this exact solution using POSTMAN and it works great. 
  • These instructions only show how to configure an Append to a spreadsheet, but you should be able to configure almost anything (like clearing the spreadsheet and exporting all values again, or updating only a specific range of cells)
  • Each external action only allows access to one specific spreadsheet and sheet (for now)
  • You need to have the GSheets API enabled and set up in the Google Cloud Console. If you do not have access to that bc your company does not allow it, there is a section that tells you the info you need to provide to your IT Team so they can configure it for you.
  • You need to have access with your user to the spreadsheet you want to edit.

 

If you have any questions, improvements or find any errors let me know and I’ll change it!

 i8gjBMbFG6tmWTwaal5220321iK9bF3GpOJUpAOStLpgFcNnJlPr3L0AkTGkDPUMXgLRIjDljNxIG2kF75BxDYbMfdI-sLVwylfshTCGOtqSHfxmLAjTnHv88ar5tvi7VoA6Jym14_LgSx8gwZLXeXQ

Prerequisites

Google cloud access + permissions

Project creation and configuration or asking your IT department to create it for you. You’l find the required information for the IT request below. 

Sharing permissions to the spreadsheet

You must have sharing permissions set to be able to edit the spreadsheet for those users defined as test users in the Google Cloud Project. 

Limitations

1 external action ⇔1 spreadsheet and range

This is a simple configuration and will be improved going forward. For now and due to Gainsight’s limitations on dynamic values for URLs, it will only allow the connection of one external action to one spreadsheet and range. If you need to access another spreadsheet you will need to configure a second external action.

 

Google Cloud project

Link to google cloud: console.cloud.google.com

How to request to your IT department

You will need either of these two options:

  1. Access to Google cloud project with the following permissions:

    1. Creation of a project linked to a billing account(nothing will be charged since it the service to be used is free) and saved within an organization’s folder(you will need permission to create a new folder or access an existing one)

    2. Creation of credentials

  2. IT department creates a project with credentials for you with the following configurations:

    Scope: https://www.googleapis.com/auth/spreadsheets

    1. Google sheets API enabled

    2. Redirect URL: The redirect URL for your specific instance can be found within the custom connector configuration and you can copy it. 

                   e.g: https://gateway.<your instance            subdomain>.gainsightcloud.com/v1/api/connector/connection/oauth/accesstoken

  1. Application type: Web Application

  2. Authorized JavaScript origins: https://<your instance subdomain>.gainsightcloud.com/ 

  3. Make User Type Internal

  4. Add Test Users: <your gainsight user> (this will be used to authenticate the connection)

  5. They will need to provide you with the CLIENT ID and CLIENT SECRET created with the credentials. You will use them to configure the connector. 

 

How to create your own project

New Project

  1. Open dropdown list from the top

c16MOFTwhQDOlqMTRihsMUJBCMlzicjlhtWIq5QOy1YpN8uwe063rhCobgnWI8aOn6CLwyooyVQdRqHcXcr2mCPTfyOQQeT5eAAjUufZ5jmoS6tnEq5O5SWXP3Vh6X41cfHNoTAI68qLxjSOvqDdi_E

  1. Select “New Project” from the top right.

Z_UkcfFg5N5ebuJPahnKzl0Lna_tkMPETyqka5k7pO_axa46Y0YFYy2K0oQMyJkv1MTZ7GV5WrAi76CksIR1oUZEJKjMgZ-3DJ7BjIklFC7OmTS4d61WYs95cci5lnp7E69Fc4FbTacdxYVVNJOHR40

  1. After creating the project, you will see it selected on the dropdown list on the top. Any configurations done while it is selected will be done within that project. 

1RP7vqhUfMzqBqogHkf7luZc0YJo13zveTqIwA6jfK-8evU2S7BkYJXvcK2ID2FWe5jpdtFWGF1CSNZm9B_j9NWpQrClCNLsLotCgiWE09CvbhYygkFYvXHJr0QpmzGwibko1E40rBZMXMoMw5xDiw

 

Activate Sheets API

  1. In the navigation menu on the left,search for API & Services

MAzClOov9_9G03gx2hkdlg6pqKxOpoiEgiYANRfOASDYfgiIp_AeNQCdCgcjzQywRdZXSLkGPGHdtSUYE5TZidwDcu_Tw2bdgMNvtNdE3GgjLnFFExIvW0UOvyOMUujbHDddyIw4h2VoPBcYIilfl2U

  1. Click on Enable APIS and Services

yOd9az4CdE4wPreGbKylOx54-o4v4M7v9dtBNPTf7wS9QMWzZH-8DMim6kas0Vc91Bg3jX-lCvsId6ibzpPd0HYT8R-PWdzghfj41jTMQsrndr36ldTAhwa1UO8ejvTGW5Uq5me0Cf1i51tjsWh98yk

  1. Search for the Google Sheets API and enable it

m0Wz_s7F_zxYReOVRJ9pD-q3kaXwETZ2q1izledDDU3TTCUFP3IgEMsrKprvV94TEcT4TBrJXcDEtvs-wZIM0d2rx1RYegRCs1qINca-_gK41uiI9Mj9rz8UAvFkVJ0WR0uHPz5QlAJjtHIKmazwqO4

NqFKM9eTBo-uJIEKXVQ-9fXC8RKOsfAsZ0UJv8QyxRwG4LQcxZnUxa10_qxVn67-cfXBPiFktUMJi64ala75u4Qdqjw02fABDK9IyvWQayau7PUCum7QC8GbPCwsARkYuKOdW96erON_lzDcLaUzoKM

Credentials and service account

  1. After it is enable it will request that you to create credentials

VtibjUjiNiDewI8vV1FK4DzWivjxEkqcqmBXwjeKgh62oxF5dUjwoqDOgCEKftw-RWXn-UwZ7ooyuAAgTOIeVdwh6yYLfNQ5v021Njgkm-1gLLnUvDidMKheoTEGCEk0EvlvstaHtPB7VyzphihJC4I

It will request to create a service account (can be used to give access to virtual machines instead of specific users) WE WILL NOT USE IT but it needs to be created. After you populate the service account name, it will automatically populate the service account id. Press CREATE AND CONTINUE and then DONE.

  1. Complete the information for Credential Type:

    Are you planning to… No,I’m not using them

    1. Select an APIGoogle sheets API

    2. What data will you be accessing: Application data

    3. Press NEXT

OAuth Consent Screen

Step 1- OAuth consent screen

  1. Select OAuth consent screen from the navigation menu
  2. Choose User TypeInternal

  3. Populate the required fields

    1. APP Name

    2. User support email

  4. Click on SAVE AND CONTINUE

Step2 - Scopes

  1. Click Add or Remove Scopes

XRGtBsApF4P-UejXE8qM_UaTrVibxxreRjYm780NzqzBINxM6gqjDEaGRsHwoJwrs2ex3KjiL8wUYNfPPNxaOXJW2-9IICtFIS1-pHQYm3vgCAQcIbQ8-Ov9D6DJ-Kusc1p0Ell02ba5Q20eBxKB4v0

  1. Search for “sheets”, check the google sheets API scope and click on UPDATE.

RxrZDjnrN6lH9gIrowjLWAo2ra-tahTEjpr360EHuxGbvuYJIm_i6iRc6PB7yYLxRGoM6jOrE9NUuqo9p3V8BTgeuyE2BpeSpWs1t8yhJOe5onfW52pSYFJzbBd92p7-J5Vz5AdTatDtk6jhzmssoIQ

  1. Check that the scope was added to “Your Sensitive Scopes”

dTqjPvWGTSIp_-6D8y5LeC5pR37-N0hQXyueOiP4xQaHy96qObA2IqF14t1mMrASEIWR7lmeR8yozY1awiP46uIuIyXUm4MHBCkWexPVmLR-_chrp00MkaxeyIue-TFDVs0e6_dDcR2INkm3L2qn8RE

Step 3 - Test Users and 4 - Summary

  1. Add your gainsight login user to the test users and press SAVE AND CONTINUE

  2. Press back to dashboard

Create OAuth2.0 client ID

  1. Select Credentials in the Navigation menu and then select Create Credentials

qQOQvENAqq3yuHmT1D9vbfw6ra0Vw0Z88UDDFoZWDQtLXjIV7YTkXU-JD2hrAjTLmdv2RE68J8m7AvdiURaKJm-ls_luUdYQp2StJDEKv5vystNpQYEt59FFdfzl5Kivq3CqNBFTgysYw8cS_qgE_L0

  1.  Choose OAuth client ID

h28fvBwfTupG7xpk0qSUHi3LFpNlwST27N8LoUk43w4ZX1IvB4LH5pEDVHVOZT4vF0JXeZwEcMg7t6riJWDszoqQXrwTaRy47gMPevkRTdsizVPa1BY-_RpIaiBsPIcFaHQwgnxOFrKgYqtxsDZeDGA

  1. Select Web Application from the drop down menu

deCnzQQD_QCzc6HmgX0XuFChz6YthpsM6CfKjT9jzfyy8w3GpF6qf99kMZUztvrXJ2qxDSwOgblu1chRUn4sW5OTRN_SzRDTX_BLqj5hxDLhaGnsSfjqFOyLQm3XfLiEY0DQsM_73Xj_7CrJ7NINA2o

  1. Add the name of this client. (e.g: gainsight)

  2. Add your instance URL under Authorized Javascript origins: https://<your instance subdomain>.gainsightcloud.com/ 

  3. Add your instance’s redirect URL under Authorized redirect URLs:

Where to find it in Gainsight? → Create a connector in the Connector 2.0 menu, and copy the redirect URL.

  1. PRESS CREATE after adding it to the credential page.

  2. The details of your credential will appear in a pop up. Copy the Client ID and the Client secret. You will need them to create the custom connector in Gainsight. 

xqL90lsy26SFxsjmEOb8XMh83Pi-ZcxQpORUO_Gc-ryW03l_D_ffYG0r5vt6vIJNXDfmJpg-0UgvDV190tya961uyhen4FKhOSn0674txe-mqEUOwdKGujT0-0b1h5ryIL9vZnLQ6QlUKgvuW9DwkMo

 

GS Custom Connector

Custom Connector 2.0 configuration

The next steps will all be done in Gainsight

  1. Within the Connectors 2.0 menu, press CREATE CONNECTION and populate the following fields:

    1. select Custom Connector

    2. Name your connection

    3. Content Typeapplication/json

    4. Authorization URLhttps://accounts.google.com/o/oauth2/auth

    5. Access Token URLhttps://oauth2.googleapis.com/token

    6. Client ID<your Google project credential client ID>

    7. Client Secret<your Google project credential client secret>

    8. Scopehttps://www.googleapis.com/auth/spreadsheets

  2. Click on AUTHORIZE. A new window will open requesting permissions and your user login. When you allow, then the connection will be done and you should be able to use external actions with this connector. 


ghBn4P-5YLcNFp-CIz01zzms9ZxyYhUSQj8J69XYlakEfU764jz6rvAMhH-l2hR3yGt2Hzzt__cPYgOP7S0N8e_CH3jwOaWIvaiFm2wXq9WsQupWQi1tPlmJSskr-xvHnlG2UZbjnTNq8c18zL9I5vY

 

External Action

  • Once you have the connector working, it’s time to configure specific external actions for this connector to be accessed by the rules engine. 

  • Due to the type of configuration available within the external actions,these instructions mean that each external action is limited to one spreadsheet and one range of cells within that spreadsheet. 

  • In this example we will use the google sheets method append. The input range is used to search for existing data and find a "table" within that range. Values will be appended to the next row of the table, starting with the first column of the table

  • More API methods can be found in the GSheets API documentation

  • We will use the valuInputOption=RAW → this tells the GSheets API to interpret only raw data, nothing you write will be interpreted as a formula. If you choose instead “USER_ENTERED” you can send “=A1+A2” and it will interpret it as a formula instead of a string.

URL

  • Call MethodPOST
  • URL template→ https://sheets.googleapis.com/v4/spreadsheets/<spreadsheetID>/values/<range>:append?valueInputOption=RAW

          <range> → needs to be written in A1 notation.

          e.g: Sheet1 (this will allow to append values to any part of sheet1)

                 Sheet1:A1:B15 (this will only allow within the A1:B15 range of sheet 1)

         <spreadsheetID> → can be found in the browser url when you open the spreadsheet.

QGxUwaEZJArEUi2mwY9xZaNbXVsTAMGzk2CAdsSGFaUIPHuzzePd3EzL8FMyrKKAh7NY_-1kbj9Q07UuHMv1MXPScIitYciOP2bcUss5TKoP3Tbr-_4KYJgtdRyHZpR12eQ8KihHbEE8NNGDRBJj5PU

Payload

  • We will define 14 possible fields to upload, each field will be a column in a row since each call of an external action will be done for each record in the dataset defined in the rules engine. 

  • Fields can be left empty and no errors will be generated. 

 

  • Use the plain option and paste the following code: 

{          

                        "values": on"{{Field1}}",

                                           "{{Field2}}",

                                           "{{Field3}}",

                                          "{{Field4}}",

                                          "{{Field5}}",

                                          "{{Field6}}",

                                          "{{Field7}}",

                                          "{{Field8}}",

                                          "{{Field9}}",

                                          "{{Field10}}",

                                          "{{Field11}}",

                                          "{{Field12}}",

                                          "{{Field13}}",

                                          "{{Field14}}"]],

                         "majorDimension": "ROWS"

}

 

Rules engine

Remember that each action defined will be applied to one record, so each record will make a call to the GSheets API and append one ROW to the spreadsheet.

Append action example

  1. Within the rules engine, you must first define the dataset as always and in the “Action Setup” step, you will have to choose Add→Call External API

  2. Choose the connector for the Google sheets API and the external action you configured.

  3. The field mapping you configured in the payload will appear and you can choose source fields or a Custom Static Value

hIYy51MShV9VbGjYGDEOQNRvl3pHi4zL-AIagM8UzV0Gm_zkjdDto10s_HF4UHN7kJ___FKyRhXxw9UWOm7avwJknlM5Oe5cvJf8iNYY6lWLXvOLFTlVwOUQRuf9iaJfYo-zJ_hANBzEhj3YO9Y8Lyw

 

Have fun and test a lot 😉

INCREDIBLE!
Something’s gone wacky with the images in your post, tho 🙁
 

 


This is REALLY great stuff -- thank you for providing a full “user’s manual” for something that will come in handy for a lot of GS Admins, @Padolfi !


Absolutely amazing, thank you so much for this.

 


Reply