hey there,
i try a very simple thing. i want to extract all rows from a google sheet, so first row, then second and so on. until all are finished. how can i do that with a loop (if i need a loop for it). I looked at the forum and just found, that loops cant do it, just with webhooks (no idea what that means and how i can do it?) And i found a solution where i just say do it 20 times, but i dont know how many times it should take, because the rows could be anything from 1 to 200. How can i do this?
Hi @Marian_Zefferer,
Better late to the party, than never I suppose. I am not sure if you are still looking for a solution to this.
But here is a simple demo that should work for what you are asking.
If you just want to run the demo, you will need a couple of things:
-
Google Sheet: I filled the sheet with some dummy data (Names in this instance, 164 of them to be precise). You can access it here.
-
Table: I only created this so I could demo how the loop will iterate through all of the data. We can verify this by checking the data added to the table (when compared to the Google Sheet).
Note: This is only for testing the demo flow yourself, to actually use the flow with your own data, you will of course, need to update the trigger and any other settings, like in the Google Sheet step to point to your sheet and data.
Pay careful attention to the Starting Row and Number of Rows. I know you mentioned that you do not know how many rows you will have specifically, so besides using a code piece, I believe you can just set the number of rows to any number, and when the piece runs, it should only fetch cells with actual data in them.
For example, you can see below that I set the number of rows to 200, but as you can see in the test results, it returned only 164:
Note: Technically, there are 165 rows in the sheet which will also account for the Header row I have at the top of the sheet. But this is excluded from the results as I set the starting row to row 2, so the header row is ignored.
Extra Note: It is also worth noting you could have the trigger as Every time a new row(s) is added, then you could also add in another Google Sheet step: ‘Get Next Row’, which would allow you to keep track of any previously extracted data. Then, each time the new flow is triggered when new data is added to your Google Sheet, it would only retrieve the latest data as it would remember the last known position it got to when extracting the data before.
Hope this helps.