Converting a Comma-Separated String into a List for Filtering in Google Sheet

Hello,

I am using OpenAI’s assistant to generate a comma-separated list, for example, “Boat, Fishing, Fish.” I would like to convert this string into a list to use it in a filter to check, for instance, if the word “Boat” matches the content of column A in my Google Sheet, then if “Fishing” matches the content of column A, and so on.

Is there a module capable of doing this, and how can I configure it? Note: The commas can be replaced with another character if the module works with a different delimiter.

Thank you.

Hello!

To achieve this, you can use the “split” function in any mapping

It will generate an Array with all items (in this example I did like you, I used comma as separator). I simulated output of AI with a Set Variable.

From this array, you have multiple options, you could play with Make functions and do comparisons after you have loaded all rows from Google Sheet, or you could iterate through the Array and search in Google Sheet if Column A = value => This is the option I chose to show you an example. It’s really up to you and what you want to achieve.


My scenario iterates each element in your list.
For this I use an Iterator, and I give it the AI string converted to an Array


Now, the scenario iterates through each item in the list. I use a Search Rows module to compare the current item with column A.


For info, my Sheet looks like this.


I used a router to route according to the outcome. If the current item is found (Total Number of bundles !=0), I do something, if not found, I do something different.

Again, i depends on what you want to achieve. In my example, if the item is found in the Sheet, then I can leverage all other fields from the Row(s) I found. If not found, I could send a notification, or add a new Row in the Sheet, etc, etc. It’s up to your needs and imagination :blush:

I hope it helps

Ben

2 Likes

Thank you very much for these clear and concise explanations! Great, an effective solution that helped me a lot. Thanks again!

3 Likes