auths
objectreturn
or this.key = 'value'
, pass input data to your code viaparams
, and maintain state across executions with$checkpoint.async
(event, steps) => {
}
// The variable `event.body` contains the HTTP payload.
// It's often easiest to construct the array of row data
// Google Sheets expects for a new row in a code step,
// so we do that here and reference the variable below
// Assumes event.body contains a name and title property,
// which we add to our Google Sheet.
const { name, title } = event.body
// We can reference this data in future steps using steps.data.array
// See https://docs.pipedream.com/workflows/steps/#step-exports
this.array = [name, title]
The array of data representing the cells of the row, for example [1, 2, 3]
The ID of the target spreadsheet, found at the end of the URL: https://docs.google.com/spreadsheets/d/{id}
The sheet you'd like to add a row to
async
(params, auths) => {
}
const data = {
values: [params.row],
}
const config = {
method: "post",
url: `https://sheets.googleapis.com/v4/spreadsheets/${params.spreadsheetId}/values/${params.sheetName}:append`,
params: {
includeValuesInResponse: true,
valueInputOption: "USER_ENTERED"
},
headers: {
Authorization: `Bearer ${auths.google_sheets.oauth_access_token}`,
},
data,
}
return await require("@pipedreamhq/platform").axios(this, config)