Split text with for each activity

I am using split string, along with For Each. By checking the function of the activity with the write line inside the for each. It works perfectly. But I need to write in google sheet, and the gsuite activity is outside the for each. When I use the item or the assign vcoment = item.tostring, being outside the for each, the result is empty. How could I solve that, so that the variable where it has the information of the split, works outside the for each.

Thank you.

Hi @Julian_Yamid_Torres_Torre ! :grinning_face_with_smiling_eyes:
For the fact that the value is empty, i think that you should check if vcomentario has been declared twice (at different scopes, or as variable and argument).

What is the information you want ? 00:55:44 or ANS[…] ?
If you want the first element (00:55:44) then anywhere in your code you can get it by writing lastLine(0).
Same goes for ANS…, you can reach the value with lastLine(1) :wink:


I want the ANS or the lastLine (1). How could I get that information? Is it necessary to use the split ?. Could you show me an example?

In assigne may be vcomment = lastLine(1) ?.

Hi @Julian_Yamid_Torres_Torre
In your case, I think you should keep split activity.
The split helps you to separate your lines, because lastLine has several lines. And as you want to have the access to the last line, you need to have a way to separate the lines, so you did well.

What is not needed is the foreach loop: you can remove it.
Instead of the foreach loop, use an assign activity. On the left: vcommentatio, on the right: lastLine(lastLine.count-1).

To show you an example i would need your xaml file to modify directly