Read multiple excel cells

good afternoon
I have an excel group in a specific folder, I use an ass to define where the folder is located and then a for each to read the multiple files.
note: these files only have 1 information cell
in the for each place a read cell activity to read cell A2 and so I throw the results that I expect.
but if an excel file of those mentioned, has more information than it should be in cells A3, A4 I also wish I could read it, but found no way to do it
Is there a way to solve my problem?
thank you very much

Using Read Range it will pull all information on the sheet, but if you don’t have a proper Header structure, then you won’t be able to export this to a Datatable meaningfully. You could use a While activity to do something similar to the following:

cellCounter = 2;
currentCell = ReadCell("A" + cellCounter.ToString());
While (currentCell != ""){
    currentCell = ReadCell("A" + cellCounter.ToString());
    if (currentCell != ""){
        cellCounter += 1;
    }
}
ReadRange("A2:A" + cellCounter.ToString);

So you can just iterate over the column and find the last row that contains data, then read the necessary information into a Datatable.

Since this gets the point across, in hindsight, it would probably be better to just use Read Range on the whole sheet, then do these actions on the Datatable, so instead of checking the output of Read Cell we would be checking the output of row.Item(0).ToString starting from the second index of the Datatable. This method would be much faster.

1 Like