Skip to main content

$integration

The $integration built-in service is used for interacting with integrations connected to the project.

tip
Before using this service, connect the necessary integration and obtain its integrationId.

Methods

Google Sheets

This integration allows accessing Google Sheets from the script: reading data from spreadsheets, writing it back, and deleting it.

In addition to integrationId, all methods using the Google Sheets integration need passing the following required parameters:

  • spreadsheetId — the spreadsheet identifier. You can copy it from the address bar.
  • sheetName — the name of the sheet you need to interact with.

`spreadsheetId`

MethodDescription
googleSheets.readDataFromCellsRead data from cells in the spreadsheet.
googleSheets.writeDataToCellsWrite data to cells in the spreadsheet.
googleSheets.writeDataToLineWrite data to a new line in the spreadsheet.
googleSheets.deleteRowOrColumnDelete lines or columns in the spreadsheet.
googleSheets.clearCellDataClear cells in the spreadsheet.

The result of calling these methods is available through the $context object. If the call is successful, $context.response.googleSheets.result takes the value "success", and "error" otherwise. Detailed information about call errors can be found in the Server logs.

caution
Google Sheets limits the number of API requests per minute. Learn more about limits

You can also use the GoogleSheets action tag to set up the Google Sheets integration. This tag can be used to manipulate spreadheet data instead of the methods above.

Custom requests

The built-in $integration methods may not be enough to fulfill your needs.

tip
Use the $integration.customRequest method to set up a custom request to any method supported by the integration API.

Testing

You can set up automated test coverage for scripts where $integration calls are made. This can be achieved by configuring mock requests and checking that the actual service responses match the expected ones.

tip
Use the <mockService> tag for setting up integration mocks.