Skip to main content

Google Sheets

The Google Sheets connection allows you to connect to one spreadsheet and make all its tabs or sheets available as independent tables in Latitude to query its data.

To add a new data source go to Settings > Data Sources > Add new data source and select Google Sheets. Remember only admins can access worksapce settings. Let’s see how to make the connection:

1. Authorize Latitude to Google Sheets

  1. Click on Authenticate Google Sheets.

  2. You will be taken to the Google sign-in page

  3. Select the Google account that contains the data you want to connect

  4. Click on Allow to give Latitude access to your Google Sheets spreadsheets

  5. Once permissions have been granted, you will be redirected to Latitude to complete the configuration. It’s time to add the Google Sheet document you want to query

2. Adding sheets to Latitude

  1. Click on Add new sheet

  2. A modal window will appear. Fill in the required fields:

    • Name → It’s the name that your document will have within Latitude
    • URL → The URL of your document. To get the URL simply open the spreadsheet in Google Sheets, copy the URL and paste it into this field. Example of URL: https://docs.google.com/spreadsheets/d/123Abc/edit?usp=drive_web&ouid=1234
  3. Click on Add new sheet

  4. Done, your spreadsheet will start syncing and when finished will be available to query in the Canvas

3. How to use

  1. Go to a project and open the Block Gallery

  2. Expand the Google Sheets section

  3. Drag and drop one onto the canvas the document that contains the data you want to query

  4. In case your document contains multiple sheets you can switch from the input in the block

  5. Now it’s available to query its data.

Considerations and troubleshooting

SQL syntax

We store the Google Sheets data in our cache, which uses Clickhouse’s SQL syntax. Check their documentation here.

Headers format

The headers format supported by our Google Sheets connection is as follows:

  • Headers or Columns title must be in the first row

  • Allow uppercase

  • Allow spaces, but they are replaced with underscores

  • Group of headers or subtitles are not allowed

Sheet name cannot be duplicated

You will probably add several sheets and sometimes we forget to rename the different sheets correctly and duplicate names can cause an error.

  • Check that the tabs of the different spreadsheets have different names

  • Soon we will fix this to avoid problems

Values imported as string

Our Google Sheet connection imports all the values as strings to avoid problems if a particular row has a different format. Aggregations don’t work with strings so you can cast the numeric columns to float, int or decimal. Here is the syntax for passing from string to another data type:

  • Float → SELECT colum_name::float
  • Integers → SELECT column_name::float::int
  • Date → SELECT column_name::date
  • Timestamp → SELECT colum_name::timestamp

We recommend that you put dates in this format to cast them YYYY-MM-DD or YYYY/MM/DD