Skip to content

stitchdata/google-sheets-integration

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Readme

This repo is a script to push data from a Google Drive spreadsheet to Stitch.

PLEASE NOTE:
This script is not supported by Stitch as an integration. Please feel free to contribute to this repository.

Requirements

This connector assumes you have headers in in the spreadsheet in row 1 of the spreadsheet.
This connector will not work if you define more than 8 columns as keys. The tab name must only include alpha-numeric characters. Remove spaces, or replace with underscores. You should make sure to set the columns to the correct data formats. For example, if a column contains all integers, please make sure it is not formatted as plain text.

Installation & Set-up

  1. Open the spreadsheet you would like to push to Stitch.

  2. Click Tools, Script Editor. Click Close on the Popup, or choose blank project.

  3. Delete the contents of the file currently open

  4. Copy the contents from this folders's sheetstostitch.gs page, and paste into the 'code.gs' script file you have open.

  5. Go back to the spreadsheet and refresh the page. If you don't see a new dropdown in the toolbar titled "Stitch Import", close the spreadsheet and re-open it.

  6. In the "Stitch Import" dropdown, click "Setup Spreadsheet for Push". You'll need to authorize the script to access the data, so log in with the Google account that has access to this sheet.

  7. Enter API key and Client ID provided in your Stitch account.

  8. Choose which columns act as the unique key for your table. These columns must be unique for all current and future rows of this table. If you have multiple columns that make up the unique key, it's recommended that you hash them together using the md5 Google Sheets function.

    More on using the md5 function

    To use this handy function in Google Sheets, enter the contents of the md5_sheets.gs file into Tools --> Script Editor. Then, to create a unique key in your sheet based on multiple columns, create an 'ID' column and in its cells enter " =md5(cell1&cell2&cellN) " where cells 1,2...N are the cells that make up your unique key. Make sure to format numbers or dates as text before using them in an md5 function to ensure the data being used to generate your unique key are in a specified format. If you plan to join this table to other data models based on this key, make sure the output matches what your warehouse generates from "select md5('cell1 contents' || 'cell2 contents' || 'cellN contents')". For more information on the function and its uses, check here and here.

Pushing another tab

If you store data in another tab that you would like to also push to the Stitch Import API, you'll need to set up the keys in that sheet as well. You can do so by clicking on that tab, and following the directions below.

  1. In the "Stitch Import" dropdown, click "Setup Spreadsheet for Push".
  2. Click "Cancel" on the API Key options and CID options.
  3. Choose the keys(s) in this tab that make each row unique. Enter the relevant column headers exactly as you have them in the sheet. If more than one, it's recommended that you hash them together using the md5 Google Sheets function.

Syncing Data

  1. Once you are ready to push data to Stitch, in the "Stitch Import" dropdown, click "Sync with Stitch".
  2. Once data has replicated to your warehouse, query it to make sure it looks right and has all of the rows you need.

Issues

If you encounter any errors, please open an issue in this repo. If you find a solution to a problem, submit a pull request.

LICENSE

The MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published