1. Tasks
  2. Log to sheet

Tasks

Log to sheet

This task logs data to Google Sheets. A specific sheet is selected with a spreadsheet id and sheet title. Values can be logged to the sheet in a variety of ways, see the examples.

An org credential is required for Stubber to gain access to your spreadsheet.

The rest of this document assumes familiarity with adding a task to a stub. See tasks documentation

Basic usage

Log a single row Col1 Heading:value1, Col2 Heading:value2 to the specified spreadsheet, in the public_log sheet. Start the table at column B and row 3.

Requirements

  • Org credential: An org credential for Google Sheets can be created in Stubber Manage
loading...

Details

orgcredentialuuid

required
string

This is a unique identifier for the org credential that Stubber should use to access the specified spreadsheet.

Default: null


Parameters

spreadsheet_id

required
string

This is the unique id of the Google Sheet on Google's system. It can be found in the url of a spreadsheet, as can be seen here "https://docs.google.com/spreadsheets/d/1ZaYk1_2-o9aefRrd4jdEFgYO0ED5hOuPlhNkE3qMitY/edit#gid=608545401". The string in bold, 1ZaYk1_2-o9aefRrd4jdEFgYO0ED5hOuPlhNkE3qMitY, is the spreadsheet_id.

Default: null


sheet_title

optional
string

The title of the sheet on the Google Sheets document to log the data to. If a sheet is specified that does not yet exist, the sheet will be created automatically.

Default: Sheet1


range

optional
string

The range of the data table on the sheet specified as starting column and row as {{column}}:{{row}}. The row and column of the headings should be used. For example, if you have (or want to create) an employees table with name, position, address columns, and you want the headings to start on row 4 and column C, the range starts with C4. The end position of the range is less strict, any value greater than the end position of your desired table is acceptible. We recommend setting this high to have some room for growth in the rows and columns of the table. For example, if your table will end at F10 for now, a range of ZZ9999 leaves a lot of room for growth.

Default: A1:Z9999


insert_headings

optional
boolean

Whether or not to insert the table headings. If this is set to true, it will insert the headings every time the task is run. So a task with this set to true should only run once per sheet.

Default: false


headings

optional
array

The headings of the table in the sheet. The headings are only inserted when a new sheet is created automatically, or when the parameter insert_headings is true. If the insert_headings parameter is true, the headings will be inserted each time the task is run, so make sure to either create the headings manually, or update the parameters from the first to the following runs of the task.

Default: null


insert_values

optional
array

The values to be inserted into the sheet. These values will always be appended to the bottom of an existing table. It can be specified in different ways:

  • A 1 dimensional array, such as [1,2,3], will add a single row with 3 columns with the values 1, 2 and 3 for each column respectively.
  • A 2 dimensional array, such as [[1,2,3],[4,5,6],[7,8,9]] will add a row for each nested array in the top level array. So the example will add 3 rows, 1,2,3, 4,5,6 and 7,8,9.

Default: null


Result

Nothing is returned in the payload of the task's result, it is only an indication of a successful write to a sheet.

loading...

Properties

Examples

Log a single row

Log a single row in an existing sheet with an existing table.

The task definition:

loading...
Result
loading...

Log multiple rows

Log multiple rows to an existing sheet with existing data.

The task definition:

loading...
Result
loading...