$integration.googleSheets.writeDataToCells
The method is used to write data to cells in a Google spreadsheet.
Syntax
The method accepts 4 required arguments.
Argument | Description | Type |
---|---|---|
integrationId | Integration identifier | String |
spreadsheetId | Google spreadsheet identifier | String |
sheetName | The name of the necessary sheet | String |
values | The data written to the spreadsheet | Array of objects |
Objects passed in the values
array should have the following properties:
Property | Description | Type |
---|---|---|
values | The data written to the spreadsheet | Array of strings |
cell | The cell coordinates | String |
An example of calling the method:
- ECMAScript 5
- ECMAScript 6
$integration.googleSheets.writeDataToCells(
"4404df16-bfc7-4bc6-9f84-65d02d000217",
"1gdkEwg2KMeKYJK-yrxgKuk9-uP7ntjtKg5ChDu8906E",
"Sheet1",
[{values: ["Carpenter", "78121770707"], cell: "C4"}]
);
In the ECMAScript 6 runtime, the method is asynchronous.
await $integration.googleSheets.writeDataToCells(
"4404df16-bfc7-4bc6-9f84-65d02d000217",
"1gdkEwg2KMeKYJK-yrxgKuk9-uP7ntjtKg5ChDu8906E",
"Sheet1",
[{values: ["Carpenter", "78121770707"], cell: "C4"}]
);
Action
The method writes the values passed as arguments to the appropriate cells on the necessary sheet.
tip
If several values are passed in the
values
array, the second and any subsequent values are written to cells in columns adjacent to the cell required.caution
In contrast to
googleSheets.writeDataToLine
, this method overwrites existing data if writing to cells that are not empty.Example
This is an example of using the method for updating the client database.