Skip to content

Google Sheets

Setup instructions
  1. Head to Google Developers Console and create a new project (or select the one you already have).
    • In the box labeled Search for APIs and Services, search for Google Drive API and enable it.
    • In the box labeled Search for APIs and Services, search for Google Sheets API and enable it.
  2. Go to APIs & Services > OAuth Consent Screen. Click the button for Configure Consent Screen
    • In the 1 OAuth consent screen tab, give your app a name and fill the User support email and Developer contact information. Click SAVE AND CONTINUE.
    • There is no need to fill in anything in the tab 2 Scopes, just click SAVE AND CONTINUE.
    • In the tab 3 Test users, add the Google account email of the end user, typically your own Google email. Click SAVE AND CONTINUE.
    • Double check the 4 Summary presented and click BACK TO DASHBOARD.
  3. Go to APIs & Services > Credentials
  4. Click + Create credentials at the top, then select OAuth client ID.
  5. Select Desktop app, name the credentials and click Create. Click Ok in the OAuth client created popup.
  6. Download the credentials by clicking the Download JSON button in OAuth 2.0 Client IDs section.
  7. Share your Spreadsheet with Editor access to Service Account that you created.

Parameters

Required parameters are in red and Optional parameters are in blue.


  • spreadsheet, the name of the Google Sheet to write data to

  • credentials_file, the full path where your credentials.json is located

  • date_time_format, the string representation of date times
    default: %Y-%m-%dT%H:%M:%S.%f ( use the strftime.org cheatsheet as a guide )

  • save_strategy, how to save new data into an existing directory
    default: OVERWRITE ( allowed: APPEND, OVERWRITE )

Serverless Requirements

If you're running CS Tools    serverless, you'll want to ensure you install these    python requirements.

🧙 Don't know what this means? It's probably safe to ignore it.

How do I use the Syncer in commands?

CS Tools accepts syncer definitions in either declarative or configuration file form.

Find the copy button to the right of the code block.

Simply write the parameters out alongside the command.

cs_tools tools searchable metadata --syncer "gsheets://spreadsheet=thoughtspot&credentials_file=/path/to/cs_tools/gsheets/credentials.json" --config dogfood

* when declaring multiple parameters inline, you should wrap the enter value in quotes.

  1. Create a file with the .toml extension.

    syncer-overwrite.toml

    [configuration]
    spreadsheet = "thoughtspot"
    credentials_keyfile = "/path/to/cs_tools/gsheets/credentials.json"
    date_time_format = "%Y-%m-%dT%H:%M:%S%z"
    save_strategy = "OVERWRITE"
    
    * this is a complete example, not all parameters are required.

  2. Write the filename in your command in place of the parameters.

    cs_tools tools searchable metadata --syncer gsheets://syncer-overwrite.toml --config dogfood