Skip to main content
Best answer

Lookup Row in Google Sheets and Looping

  • October 11, 2023
  • 3 replies
  • 1061 views

arrw24
Forum|alt.badge.img

Ugh! I’m stumped!

I’m looking up a GSheet Row (example below)

...and it’s returning the following when looking up “Sweep” in Column A.

 

My Problem: Google doesn’t return a comma separated list, it separates each value. This means the “Loop by Zapier” step can’t grab all of them at once (see below). I’ve tried using the Formatter > Line Item to Text, but because the number of columns returned is variable (for instance, “Mow” will only return 2 columns) I can’t get it to work correctly.  

Best answer by Troy Tessalone

Hi @arrw24 

Good question.

GSheets returns data for each column as a separate value.

One option would be to put each Task comma separated into 1 column (e.g. Column B and rename as Tasks)

Then you can use the Zap action: Looping > Create Loop from Text

 

Or you can pivot the data to have 1 row per Type/Task. (so 2 Columns only - Type in Column A & Task in Column B)

Use the GSheets Find Rows to find all the rows matching the Type.

Then you can use the Zap action: Looping > Create Loop from Line Items

 

Another option is use Airtable instead of GSheets.

Airtable is a relational database app.

You can link records across Tables to create relationships.

That would return data as an array of line items.

 

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

3 replies

Troy Tessalone
Zapier Orchestrator & Solution Partner
Forum|alt.badge.img+14
  • Zapier Orchestrator & Solution Partner
  • Answer
  • October 11, 2023

Hi @arrw24 

Good question.

GSheets returns data for each column as a separate value.

One option would be to put each Task comma separated into 1 column (e.g. Column B and rename as Tasks)

Then you can use the Zap action: Looping > Create Loop from Text

 

Or you can pivot the data to have 1 row per Type/Task. (so 2 Columns only - Type in Column A & Task in Column B)

Use the GSheets Find Rows to find all the rows matching the Type.

Then you can use the Zap action: Looping > Create Loop from Line Items

 

Another option is use Airtable instead of GSheets.

Airtable is a relational database app.

You can link records across Tables to create relationships.

That would return data as an array of line items.

 


arrw24
Forum|alt.badge.img
  • Author
  • Beginner
  • October 11, 2023

@Troy Tessalone you’ve saved my @$$ 3 times in the past week. RESPECT!

I ended up converting the spread sheet to two columns and then using a Formatting step to convert the Line Items to Text. 😀


SamB
Community Manager
Forum|alt.badge.img+11
  • Community Manager
  • October 12, 2023

Yay! That is fantastic news @arrw24! 🎉 Awesome work here as always, @Troy Tessalone! 👏👏👏 

So pleased you were able to get this sorted. If you do run into any further issues or have any questions at all please do reach out again - the Community is always eager to help! 🤗