Google Spreadsheet CLI Guide

Step 1 : Download an existing configuration

To get a template for the Google Spreadsheet connector configuration save the output of the describe --input-parameters command as follows:

datacoral collect describe --slice-type spreadsheets --input-parameters > googlesheets.json

Step 2 : Update the parameters file

Modify the parameters (googlesheets.json) file with the below mandatory fields.

Example template for downloaded parameters file

{
"loadunits":
{
"loadunit_name":
{
"spreadsheetId":"Id of the Google Spreadsheet (found in the URL) (string)",
"sheetName":"Name of the Sheet to fetch (string)",
"range":"Comma separated ranges of columns to fetch in A1 Notation ex. A2:C,E2:F (string)",
"columnNameRange":"Comma separated header row ranges in A1 Notation ex. A1:C1,E1:F1 (string)"
}
},
"clientId":"Google API OAuth client id (string)",
"clientSecret":"Google API OAuth client secret (string)",
"redirectUrl":"Google API OAuth redirect url (string), default - \"urn:ietf:wg:oauth:2.0:oob\"",
"accessToken":"Google API OAuth access token (string)",
"refreshToken":"Google API OAuth refresh token (string)",
"TargetWarehouses":["<warehouse-name>"]
}
  • Sign into your google account and go to Google console for developers
  • Click on create credentials > OAuth Client ID
  • Under Application type choose 'web application'
  • Add the below URI under Authorized redirect URIs and click create
https://developers.google.com/oauthplayground
  • OAuth client gets created with Client ID and Client Secret. Please save these credentials on clipboard.
  • Go to Google developers site and follow the steps here to create access token and refresh token

Step 3 : Add the connector

datacoral collect add --slice-type spreadsheets --slice-name <connector-name> --parameters-file <params-file>
  • <connector-name> Name of your connector. A schema with this name is automatically created in your warehouse
  • <params-file> File path to your input parameters file. Ex. googlesheets.json

    Please make sure that the <params-file> adheres to the format shown in Step-2

Got a question? Interested?

Please contact Datacoral's Support Team, we'd be more than happy to answer any of your questions.