Loop Action - Loop thru data or for a certain number of iterations

Loop action will allow us to run a loop with some data. This is to allow to leverage google sheet as a kind of middleware or to perform certain actions based on per row basis.

As example for each row in table, if col X = Y, delete row.
In @danfernandez case, he wanted to check if a row contains a Zip, and if its empty we want to delete it.

See SS of table

Yep, I agree. I’ve seen the same need to do loop though of scraped data, so each row can go though actions.

A use-case example:

  1. Scrape a tool directory into Google Sheets.
  2. Then send a daily message/email with one tool per day.

This isn’t possible.

Hi Deyan,

As you might have noticed by now, all our actions loop over the data. The playbook you describe can be constructed as:

  • Get table from Spreadsheet
  • Get rows from table
  • If Row.Column equals Value
  • Delete row from Spreasheet

(“Get rows from table” shouldn’t be necessary, and won’t be necessary in the future, but it’s necessary now when using tables and conditional statements)
(We don’t yet have a delete from Google Spreadsheet action, but the same would work for say, Coda or Airtable, for which we have the action)

The use case that Ivan describes is quite different, but I’d like to understand yours first, and why you think it’s not solvable with the current primitives.

Thanks for your input!

1 Like

Hey gcampax,

I have noticed that, but just to clarify the last action which is delete row does not exist so than this is currently not achievable with Google Sheets.

I am not sure what * Get rows from table does that is different from what Get table from Google Sheet does not. Does it return the data in a different way?

Further more “is empty” evaluator does not work in the conditional statements to check if a cell is empty.

I would expect that to return a YES.



image

The conditional does not have Yes OR No for each respective item, the last option you got runs both Yes AND No. So the flow cannot be controlled for each item in a table/array.

If I try not to delete the rows but just to add them to a different sheet it still does not work. I cannot access the data to write it.

I am not sure I fully understand the intention you guys have behind the conditional.

Here is the Book and Sheet. I would appreciate if you could create a short video with explanation how to achieve that and what I am doing wrong.

I am not sure what * Get rows from table does that is different from what Get table from Google Sheet does not. Does it return the data in a different way?

“Get rows from a table” takes one table with N rows and returns N tables with 1 row each. The tables are then processed individually by the conditional statement.

Further more “is empty” evaluator does not work in the conditional statements to check if a cell is empty.
I would expect that to return a YES.
The conditional does not have Yes OR No for each respective item, the last option you got runs both Yes AND No. So the flow cannot be controlled for each item in a table/array.

The conditional you show has “Run YES if at least one item matches”. Because at least one row is not empty, the YES branch runs for all rows. That’s not what you want.
In the vast majority of cases, you’ll want “Runs both YES and NO”. While the wording might be confusing, it means it runs the YES branch for the rows that match and the NO branch for the rows that don’t match. In other words, it’s what you want here.

I am checking if Convert To string contains NA expected YES. Returned YES and NO
Book


image

Yeah this is the behavior as implemented: both branches are run, with the portion of the data that passes / does not pass the filter. Because neither branch uses the data, both branches run identically.
I don’t think this is intuitive, and neither it is quite the expected behavior.
I think we should change it so if some branch is completely empty, it is not executed at all, which should give the expected behavior in this case (only execute the Yes branch).

I will update this thread when we fix this.

1 Like

I appreciate that Bardeen does the looping internally. What my issue is that I would like to read a table from a Google sheet containing a column of URLs, then open the URLs one by one and grab some data from the page then re-insert it back to the Google sheet as the next column.
If I use Get rows from table, as you mentioned there will be N tables containing 1 row each. Say if I process each row and write the data back to the Google sheet, would it remember which row it is that it needs to write the new column entry on? If yes, could you give me an example of how this could be done? Much appreciated.

For your case you can simply use Get table from Google Sheets than use Scrape data in the Background to get the data you need and to add the data back to a different column withUpdate Google Sheet rows/tab rows

1 Like