Create a Google Sheet from JSON array

universalIntermediate

Tray.io Community Collaboration We built this template in collaboration with Zeyuan Zhao (Level 4 Artisan builder and member of the Tray.io Slack community) **

How to use this template

The first thing you'll want to do when you load the template into your workspace is add authentications for the Google Sheet connectors and Google Drive connector. We suggest testing the workflow with a basic array of data first, so create a manually triggered workflow and grab a list of test data using either an existing connector you’ve previously used to grab arrays/lists of data or you can use the “List Customers” operation from our CRM Trayning connector. Once you’ve identified a list of data you would like to add to a Google Sheet, you can begin setting up the connector to this callable workflow by adding a callable workflow connector to your builder canvas with the “fire and wait for response” operation set and the workflow selected: array to gsheet - callable setup Next, you’ll choose the “operation” of the callable: array to gsheet - choose operation If you choose to "create a new sheet", then provide a name for the spreadsheet: array to gsheet - name sheet If you wish to edit an existing sheet, specify the URL of the sheet (make sure the sheet is shared such that the auth you are using can edit the sheet): array to gsheet - sheet url The “sheet name” is used to name the specific sheet you’ll create or update in the spreadsheet: array to gsheet - sheet name array to gsheet - sheets tab The “sheet action” is used for cases where you are updating an existing sheet: array to gsheet - sheet action Replacing all data wipes any existing data in the sheet out and adding data to the sheet appends the data to the end of the active rows. Next, you’ll map the array of data you wish to send to the sheet: array to gsheet - map array You can send the workflow three types of arrays:

  1. Array of objects - If you’re creating new sheet or replacing data in an existing sheet, the workflow will transform the object’s properties into the column headers of the sheet. If you’re adding data to an existing sheet, no headers will be created.
  2. Array of non-objects or non-arrays (e.g., integers, strings, etc) - This would result in a single column of data in the sheet.
  3. Array of arrays - Each child array will act as a row and each item in the child array will act as a cell value in the row, where the first item is the left most cell and last item the right most cell. Finally, you can optionally specify a list of emails you wish to share the sheet with. This might be helpful if you want them to get a sharing notice from drive or just have it accessible to them when you send them a link. The response of the workflow includes the following data: array to gsheet - output schema