Error in update rows

I’m trying tu update a column in my sheet with the values of an split function, the result is not correct:
image

I want to update the first row with test1 and the second with test2.

blueprint (16).json (21.1 KB)

Hey @Marco_Ochante,

  1. You can delete the iterator module - Google Sheets (Search rows) module already returns bundles rather than an array, so you don’t need to iterate through its outputs. Everything after that module will iterate per found row anyway
  2. In the last Google Sheets module, wrap your split() formula inside a get() formula - this will allow you to grab a specific value from your test array:

{{get(split(10.test; ","); 1.`__IMTINDEX__`)}}

What this formula does:

  • split() creates an array of text values - in your example, after splitting, the variable test = test1,test2 becomes an array with two rows:
    test(1) = “test1”
    test(2) = “test2”

  • get() lets you grab a specific value from an array. Here you would specify eg:
    get(test; 1) if you want to grab the first value (test1), and get(test; 2) if you want to grab the second value (test2)

  • Bundle order position is a variable that numbers/orders your search results from Google Sheets. First row that was found will have position = 1. Second row will have position = 2. And so on.


While this will technically work, it does assume that you want to map your test variable to your Google Sheet rows exactly 1-to-1 in this exact order:

  • (found first result in Sheets) > (map first value from split() string)
  • (found second result in Sheets) > (map second value from split() string)
  • … etc.

So if, for example, your Sheets module returns 7 rows, your test variable would need to have 7 values to ensure each gets mapped to one row. test = test1,test2, ... test7)

If this isn’t what you were looking for, can you explain your actual use case for this automation? It will be easier to figure out the right solution for you then.


Cheers!

1 Like

Thanks @SierraV. It works. What I really want to do is to add a column to a sheet using bulk update. The values of that column are inside of a list, but when I run the scenario, the result is duplicated. For example, if I expect:

Column A | Column B
test1 | coment 1
test2 | coment 2

The result is:
Column A | Column B
test1 | coment 1
test1 | coment 2
test2 | coment 1
test2 | coment 2

blueprint (18).json (66.6 KB)

Hey @Marco_Ochante - glad to hear it works!

Thanks for providing the blueprint; you’re almost there:

Visualize bundles

In case this is helpful in the future: from the bottom toolbar, click on the 3 dots > Explain flow. This will let you visualize how your scenario processes bundles:

In your scenario, when the flow gets to the part where you have modules Google Sheets > Iterator > Array Aggregator, you’ll notice that for each row in the sheet, iterator splits the comments into one bundle for each comment – causing each row to have multiple copies.

IM_zaNKvCm03fspOElFpW_x

How to fix this

  1. Delete the iterator module

  2. In the aggregator, replace column 5 “value” with:
    {{get(15.comments; 47.`__IMTINDEX__`)}}

That should solve the duplication issue and you should end up with one comment per row.


Cheers!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.