Can I Use the Google Sheet Get All Values App to Save a List of IDs and Run a Workflow Against Each Value?

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

I was to save a list of ID’s to a spreadsheet to use later on.

Is it possible to use the Google Sheet Get All Values App and then run workflow against each value?

Yes, you can use the Google Sheets app to get all values from a sheet and then process each value in your workflow. First, you’ll need to use the “Get All Values” action from the Google Sheets app. Then, you can use a code step to iterate through the values and perform any desired actions. Here’s an example of how to do this: 1. Add the “Google Sheets - Get All Values” action to your workflow and configure it with the required inputs (spreadsheet ID, sheet name, etc.). 2. Add a code step after the “Get All Values” action with the following code: export default defineComponent({ async run({ steps }) { const values = steps.get_all_values.$return_value.values; for (const row of values) { // Process each value (row) here console.log(row); } }, }); In this example, steps.get_all_values.$return_value.values contains the values from the Google Sheet. The code iterates through each row of values and logs them. You can replace the console.log(row) with any actions you want to perform on each value.

Please alter that code to run a HTTP call and append the value at the end.

Sure, I can modify the code to make an HTTP call for each value and append the value at the end of the response. Here’s the updated code: import { axios } from "@pipedream/platform"; export default defineComponent({ async run({ steps }) { const values = steps.get_all_values.$return_value.values; const results = []; for (const row of values) { const response = await axios(this, { method: "GET", url: `https://your-api-url-here/${row}`, }); results.push({ value: row, response: response.data }); } return results; }, }); Replace https://your-api-url-here with the actual API URL you want to call. This code will make an HTTP GET request for each value in the values array, appending the value at the end of the URL. It then stores the value and the response data in the results array, which is returned at the end.