Problem with read range activity in excel


#1

I am facing an issue with read range activity of excel.

  • In read range activity i am giving the range value as “A2” because i want the bot to ignore the first row because it contains column headings.
    there is a sheet in excel called “Sheet1” containing four rows .the count method of data table works fine in this case. However if i create a replica of “Sheet1” and only copy the first row which contains column headings .the count method return 1 as output which ideally should not happen because we are reading from “A2” cell.
    Can someone suggest a reason for the same.
    Thanks in advance
    cheers…

#2

If you want to ignore the headers, just check the “add headers” option in the read range activity. The first “row” of the datatable will be the data from row 2 of your spreadsheet. Therefore if you datatable.count, it would return one less than the total number of rows in excel.

How are you reading the first row when you specify a range of the second row? I don’t quite understand this part.


#3

I have unchecked the “add headers” option because I am considering the column index rather than column headings so wants to skip the first row i.e. column headings and read the sheet from range "A2 " using “Read Range” activity.

But sheet does not contain any data from A2 cell but still it returns row count 1 as output.

Can suggest me a reason reagarding to this issue.


#4

You can still use column index when the column headers are present. When you uncheck “add headers”, UIPath inserts its own headers anyway. (column0, column1 etc). You can output the datatable to verify this.

So when you’re reading the range from A2 without the headers, the robot is picking up that first row as data even though there is nothing in it, because otherwise the value of the datatable returned would be null.

Header 1	Header 2	Header 3
x	        y	           z
z	        y	           x

If the robot read the above with “add headers” checked, it would return a .count of 2 and the header names would be those specified above.

If the robot read the above with “add headers” not checked, it would return a .count of 3 and the header names would be “column0”, “column1” etc

You can adjust your code to account for this offset in excel as I think it’s more straightforward to read the whole range, rather than try to specify it when the data could be dynamic.


#5

Thank you so much and Now I am getting the root cause of given issue…