Append

Appends values to a spreadsheet

10 variables
12 variables

Appends values to a spreadsheet. The input range is used to search for existing data and find a "table" within that range. Values will be appended to the next row of the table, starting with the first column of the table. See the guide and sample code for specific details of how tables are detected and data is appended.

The caller must specify the spreadsheet ID, range, and a valueInputOption. The valueInputOption only controls how the input data will be added to the sheet (column-wise or row-wise), it does not influence what cell the data starts being written to

Authorization

To use this building block you will have to grant access to at least one of the following scopes:

  • See, edit, create, and delete all of your Google Drive files
  • View and manage Google Drive files and folders that you have opened or created with this app
  • View and manage your spreadsheets in Google Drive

Input

This building block consumes 10 input parameters

  = Parameter name
  = Format

spreadsheetId STRING Required

The ID of the spreadsheet to update

range STRING Required

The A1 notation of a range to search for a logical table of data. Values will be appended after the last row of the table

responseValueRenderOption ENUMERATION

Determines how values in the response should be rendered. The default render option is ValueRenderOption.FORMATTED_VALUE

insertDataOption ENUMERATION

How the input data should be inserted

valueInputOption ENUMERATION

How the input data should be interpreted

responseDateTimeRenderOption ENUMERATION

Determines how dates, times, and durations in the response should be rendered. This is ignored if response_value_render_option is FORMATTED_VALUE. The default dateTime render option is [DateTimeRenderOption.SERIAL_NUMBER]

includeValuesInResponse BOOLEAN

Determines if the update response should include the values of the cells that were appended. By default, responses do not include the updated values

range STRING

The range the values cover, in A1 notation. For output, this range indicates the entire requested range, even though the values will exclude trailing rows and columns. When appending values, this field represents the range to search for a table, after which values will be appended

majorDimension ENUMERATION

The major dimension of the values.

For output, if the spreadsheet data is: A1=1,B1=2,A2=3,B2=4, then requesting range=A1:B2,majorDimension=ROWS will return [[1,2],[3,4]], whereas requesting range=A1:B2,majorDimension=COLUMNS will return [[1,3],[2,4]].

For input, with range=A1:B2,majorDimension=ROWS then [[1,2],[3,4]] will set A1=1,B1=2,A2=3,B2=4. With range=A1:B2,majorDimension=COLUMNS then [[1,2],[3,4]] will set A1=1,B1=3,A2=2,B2=4.

When writing, if this field is not set, it defaults to ROWS

values[] OBJECT_ARRAY

Output

This building block provides 12 output parameters

  = Parameter name
  = Format

updates OBJECT

The response when updating a range of values in a spreadsheet

updates.updatedRows INTEGER

The number of rows where at least one cell in the row was updated

updates.updatedData OBJECT

Data within a range of the spreadsheet

updates.updatedData.range STRING

The range the values cover, in A1 notation. For output, this range indicates the entire requested range, even though the values will exclude trailing rows and columns. When appending values, this field represents the range to search for a table, after which values will be appended

updates.updatedData.majorDimension ENUMERATION

The major dimension of the values.

For output, if the spreadsheet data is: A1=1,B1=2,A2=3,B2=4, then requesting range=A1:B2,majorDimension=ROWS will return [[1,2],[3,4]], whereas requesting range=A1:B2,majorDimension=COLUMNS will return [[1,3],[2,4]].

For input, with range=A1:B2,majorDimension=ROWS then [[1,2],[3,4]] will set A1=1,B1=2,A2=3,B2=4. With range=A1:B2,majorDimension=COLUMNS then [[1,2],[3,4]] will set A1=1,B1=3,A2=2,B2=4.

When writing, if this field is not set, it defaults to ROWS

updates.updatedData.values[] OBJECT_ARRAY

updates.updatedColumns INTEGER

The number of columns where at least one cell in the column was updated

updates.spreadsheetId STRING

The spreadsheet the updates were applied to

updates.updatedRange STRING

The range (in A1 notation) that updates were applied to

updates.updatedCells INTEGER

The number of cells updated

tableRange STRING

The range (in A1 notation) of the table that values are being appended to (before the values were appended). Empty if no table was found

spreadsheetId STRING

The spreadsheet the updates were applied to