Question

How do I search a column in a Google Sheet?

  • 21 December 2020
  • 9 replies
  • 738 views

Userlevel 1

I’m trying to search a google sheet’s column for a value, and only if it the value is present, then continue with the Zap.

I’ve tried a bunch of the Google Sheet Action Events (namely: ‘Lookup Spreadsheet Row’) but am not getting the effect I need. Really struggling to see how to find out if a value is present in a column.

Thanks for any help with this! :)


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

9 replies

Userlevel 7
Badge +10

HI @MGZ 

Do you mean you want to search the column header for a certain value?

Userlevel 1

Hi Andrew,

I have a column of country codes in column B of the google sheet. I wish to refer to this column and check if it contains a specific country code. If it does, then my Zap continues, if it doesn’t then the Zap stops.

So far I have all the parts of my Zap figured out, apart from this one step of checking this Google Sheet’s column for a county code. My reason for storing these country codes in a google sheet column is that I will be referencing this same google sheet column multiple times from multiple Zaps and so being able to edit the list of country codes in one place (the google sheet column) is a big advantage.

If it’s not possible to do this using Google sheets, perhaps there is an other method in Zapier to achieve the same effect?

Thanks for the help!

Userlevel 7
Badge +14

Try this Zap action step: GSheets - Lookup Row

 

Userlevel 1

Hi Troy,

I’ve tried that one, but when there is no match it outputs the error:

“Bargle. We had trouble getting a matching spreadsheet row. :-(Error details:
Nothing could be found for the search.”

I think this prevents the Zap from working, or is this error not an issue?

Thanks!

Userlevel 7
Badge +14

The Zap won’t continue to steps in the Zap that rely upon data from the GSheet Lookup Row step if NO result is returned from the GSheet, and that will produce an error in the Zap Task History: https://zapier.com/app/history/

 

To fail gracefully and avoid errors in the Zap Task History, you could add a Filter step after the GSheet Lookup Row step: https://zapier.com/apps/filter/help

Userlevel 1

Thanks for the help Troy. I can’t seem to see how the filter step would help though.

Perhaps I should store the list of Country codes on a different platform that is easier to reference from a Zap for a simple exists/doesn't-exist toggle for continuing?

Userlevel 1

Found a workaround in case others run in to the same issue…

Make the Google Sheet column of data a row instead and use “Get Many Spreadsheet Rows (Advanced, With Line Item Support)” to grab the whole data set to check against later on in the Zap as needed.

Userlevel 7
Badge +14

The Filter step would prevent the Zap from continuing if no result was returned from the GSheets Lookup Row step.

Filter logic would be: Country exists

Userlevel 7
Badge +11

Hi @MGZ!

To reiterate what Troy has said, when you add a filter and look for a field to exist in a search step, then you can control whether the Zap continues on to later steps.

I am curious, though, about the workaround you mentioned. Would you be able to elaborate a bit or show a screenshot of how you’ve got that set up. I’m not 100% clear on how this would be more effective than having it in a column.