Fetch data from an undefined or last sheet in Google Sheet

Hello everyone!

In my integration project I need to get data in one sheet in Google Sheet.

My problem is: The data I need is on a sheet whose name is unknown, but it is always known to be the last sheet.

Is there any possibility to fetch the data this way? That is, indicate the search on a sheet according to its position within the spreadsheet?

Some information to understand what I am looking for:

A chatbot will capture data that will be stored on a sheet. For each customer served a sheet is created. The automation will be performed as soon as the chatbot service ends, so we know the data is on the last sheet of the spreadsheet.

Thanks!

How are you?

You could try using Get Sheets to get an array with the names of all the sheets, and then store the last entry of the array in a variable.

After that you can use that variable to work with the sheet.

1 Like

Pls use ‘Get sheets’ activity which will give you array output of sheets
Then use for each loop , for each loop of SheetsArray
For each argument type should be string
Create a counter variable (int) and give default value as zero
Inside for each loop body use a if condition
Condition as
counter = sheetsarray.length
Then use read data from that sheet

Below to the if condition use assign activity
Counter = Counter +1

1 Like

How are you?

Thanks for the feedback!

Would a matrix be more appropriate even if the number of sheets changes constantly?

Thank you!!!

Thanks for your help!!!

I did as suggested (Although there is a possibility that you have gone wrong at some step).

I got the number of sheets in the document. Should the result be anything else? Or, how could I use this information? Is it possible to indicate the sheet to be used by informing its position in the spreadsheet?

Thanks again!

Please use like the below .
Attached the sample code

Main.xaml (10.5 KB)

1 Like

Hi my friend!

I couldn’t make it your way. But, I greatly appreciate the attention.

Searching the forum I found a solution. Just call the “variable.last” that or the last element is displayed.

I will register here the link:

thanks!

2 Likes

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