Sure, I can help you with that. To add multiple rows of data to a Google Sheet using a custom code step, you’ll need to use the Google Sheets API. First, make sure you have connected your Google account to Pipedream. Here’s an example Pipedream component that appends multiple rows to a Google Sheet: import { axios } from "@pipedream/platform"; export default defineComponent({ props: { google: { type: "app", app: "google", }, spreadsheetId: { type: "string", label: "Spreadsheet ID", }, sheetName: { type: "string", label: "Sheet Name", }, data: { type: "string[]", label: "Data", description: "Enter each row as a JSON array of values, e.g. [\"A1\", \"B1\"]", }, }, async run({ steps, $ }) { const parsedData = this.data.map((row) => JSON.parse(row)); const range = `${this.sheetName}!A1`; const url = `https://sheets.googleapis.com/v4/spreadsheets/${this.spreadsheetId}/values/${range}:append`; return await axios($, { method: "POST", url, headers: { Authorization: `Bearer ${this.google.$auth.oauth_access_token}`, "Content-Type": "application/json", }, data: { range, majorDimension: "ROWS", values: parsedData, }, params: { valueInputOption: "RAW", insertDataOption: "INSERT_ROWS", }, }); }, });
In this example, you’ll need to provide the spreadsheetId
, sheetName
, and data
as input props. The data
prop should be an array of strings, where each string is a JSON array of values representing a row in the sheet. For example, if you want to add two rows with values “A1”, “B1” and “A2”, “B2”, you would enter: ["[\"A1\", \"B1\"]", "[\"A2\", \"B2\"]"]
This component will append the rows to the specified sheet using the Google Sheets API. Make sure to replace the spreadsheetId
and sheetName
with the appropriate values for your Google Sheet.