$integration
The $integration
built-in service is used for interacting with integrations connected to the project.
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.
Method | Description |
---|---|
googleSheets.readDataFromCells | Read data from cells in the spreadsheet. |
googleSheets.writeDataToCells | Write data to cells in the spreadsheet. |
googleSheets.writeDataToLine | Write data to a new line in the spreadsheet. |
googleSheets.deleteRowOrColumn | Delete lines or columns in the spreadsheet. |
googleSheets.clearCellData | Clear 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.
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.
$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.
<mockService>
tag for setting up integration mocks.