Read range Excel

Hi all, i face the problem when use Read range activity to count all Row in Excel. But while my Excel not contains data, number Rows still > 0. i’m make sure check “Header” in properties panel. Please give me the explains for this problems, thanks so much.

hmm…usually if there is no data in a excel and if ADD HEADERS property if enabled in READ RANGE activity then the datatable.Rows.Count value will be zero only…
if possible can i have a view on that excel file
Cheers @TanVuong

1 Like

@TanVuong
As per what I understand, you are using read range activity to read from excel file and trying to USE the count of the number of rows in the datatable.

When you are do so, even when the excel file is empty, you are getting number of rows to be more than 0.

If above is the case, there are few pointers to make sure you are on the right path:-

  1. Check the sheet name, file name and the datatable varibale name. In most of the case we do mismatch in hurry. There is very high chances of using incorrect filepath, filename, variable name.

  2. Use the unit testing for only read range and put the count of the datatable row count in the message box.

  3. You can do above as: - dtName.rows.count.tostring in the message box.

Please try the same and let me know how it goes.

Regards,
@hacky

1 Like

@TanVuong
Hi, is it a new Excel file? I once saw that people were deleting the rows in a strange way which led to UiPath counting more rows than actually were filled.

Try using the count on a new Excel file or make sure that all the rows in Excel are deleted properly.

DvdZ

1 Like

thank for advance, here is my file.
I’m tried set range from A4:Z300 and not set header but number of Row counted is 294.
HR- Candidate Database .xlsx (144.2 KB)

@TanVuong

There are four sheets. As I said, please check the sheet names which you are using in your activity.

1 Like

thank for advance, but before create this post, i did test same you guide, but the result not explain to me exactly. I make sure the path or file name always correct.

yeah, i make sure choose correct sheet i needed.

Hi, it probably counts the rows because the cells have a layout. If you need to count the rows that do have a value I would suggest to use a filter data table activity.

Use the DataTable as input and as output - > Filter on one of the colomns with the Operation: Is Empty and remove these rows.

If you count the rows after the filter you will end up counting 0 rows in the case of the file you send

Is this a solution to your problem?

1 Like

yeah, i think your solution seem for my problems, i will try it. But i face a different problems, my uipath studio and uipath robot not match version, are you face the same problem?, if yes , give me a solution to fix it. thank u so much.

I have an Excel with more than 40k rows, but read range does not read all the sheet. What can i do? What could be the problem?

Hi,
Usually when there is no row in Data Table , row count comes to 0.

Can you share your excel file for more information of your issue.

Thanks and regards
Sahil Garg

Hi,
To read different sheets, you have to mention sheet name in Read Range.

As one Data Table variable can store only one sheet.

Thanks and regards
Sahil Garg

Hi, it is just one sheet, with information between column A and V, with more than 40k rows, I need to read column C and J but read range gets only like 400 rows

Hi
Is there any empty row in between the records especially after 400 row

Cheers @Alexa_Caro