This topic was automatically generated from Slack. You can find the original thread here.
I want to send a webhook request for every row in a Google sheet. I use the “new row” trigger, but that’s only for adding rows, not editing them. I tried the new updates, but that gives before and after and is very difficult to parse. What’s the best way to approach this?
Specific example:
If sheet row is name, email; I want to send a webhook with value name = {{name}} and email = {{email}} in the body
I want to send a webhook request for every row in a Google sheet. I use the “new row” trigger, but that’s only for adding rows, not editing them. I tried the new updates, but that gives before and after and is very difficult to parse. What’s the best way to approach this?
Specific example:
If sheet row is name, email; I want to send a webhook with value name = {{name}} and email = {{email}} in the body
To achieve your goal of sending a webhook request for every row in a Google Sheet, you can use the “New Row Added” trigger to capture new rows and then iterate over each row to send the webhook request. Since you mentioned that the “new updates” trigger is difficult to parse, focusing on the “New Row Added” trigger might be the best approach. Here’s a step-by-step guide on how to set this up: 1. Create a new workflow in Pipedream. 2. Add the “New Row Added” trigger from the Google Sheets app. 3. Connect your Google Sheets account and configure the trigger to point to your specific sheet and worksheet. 4. Add an HTTP request action to send the webhook for each row. Here is an example of how you can set up the HTTP request action to send the webhook with the row data: ```
import { axios } from “@pipedream/platform”; export default defineComponent({ props: { google_sheets: { type: “app”, app: “google_sheets”, }, webhook_url: { type: “string”, label: “Webhook URL”, }, }, async run({ steps, $ }) { const rows = steps.trigger.event.values; for (const row of rows) { const [name, email] = row; await axios($, { method: “POST”, url: this.webhook_url, data: { name: name, email: email, }, }); } }, });
ok so it seemed to work only when i deployed the workflow when the sheet didnt have rows populated, then populated then. it did not work when the workflow was deployed with rows populated, then removed, then populated again.