How to Hit Webhook URL to Retrieve Google Sheet Data Using Node JS?

This topic was automatically generated from Slack. You can find the original thread here.

Task: i want to hit the Webhook url and it should return me Google sheet data… not sure how to achieve this i tried the below code in node js code but facing an error

import { GoogleSheets } from "@pipedream/platform";

const sheets = new GoogleSheets(this.google.$auth.oauth_access_token);
const spreadsheetId = "YOUR_SPREADSHEET_ID";
const range = "Sheet1!A1:Z"; // Adjust the range according to your sheet

const result = await sheets.values.get(spreadsheetId, range);
return result.data.values;

can you help fix this code

import { GoogleSheets } from "@pipedream/platform";

const sheets = new GoogleSheets(this.google.$auth.oauth_access_token);
const spreadsheetId = "YOUR_SPREADSHEET_ID";
const range = "Sheet1!A1:Z"; // Adjust the range according to your sheet

const result = await sheets.values.get(spreadsheetId, range);
return result.data.values;

I see that you’re trying to fetch data from a Google Sheet using Pipedream. To achieve this, you can use the following Pipedream component code: import { GoogleSheets } from "@pipedream/platform"; export default defineComponent({ props: { google: { type: "app", app: "google", }, spreadsheetId: { type: "string", label: "Spreadsheet ID", }, range: { type: "string", label: "Range", default: "Sheet1!A1:Z", }, }, async run({ steps, $ }) { const sheets = new GoogleSheets(this.google.$auth.oauth_access_token); const result = await sheets.values.get(this.spreadsheetId, this.range); return result.data.values; }, }); This code defines a Pipedream component with the necessary props for the Google Sheets API. Make sure to replace "YOUR_SPREADSHEET_ID" with your actual spreadsheet ID when using this component.