Read Range for Excel not producing expected output

I am trying to read an Excel file into a data table.
I use the output data table and then message box to check if the data table is being read correctly.
When I specify “” in the Range to be read, the message box does not pop up.
When I specify a certain range eg. “A1:U10” then the message box would pop up (and the data table is being read correctly) - but I want the automation to be versatile to be able to pick up all the data in the sheet.
What’s the reason for this?

Thank you in advance for your help!

1 Like

Hi there , if you want all the sheet data don’t specify a range leave it in blank instead of “A1:U10” just place " ".

When I place " " and check the output using output data table and then message box, the message box stops working (ie. there’s no pop up). Or when I output data table to a log message using .ToString it just says “Datatable”
Any possible errors that cause this?

yes , it will say “DataTable” cause you are just sending the Datatable object you have to map the data to show it using "for each row " activity and then inside the activity you place you message box the inside the input box put “row(“YourRowName”).ToString”

I recommend using the “Log message” activity to check the data is easy to check in the output tab.

1 Like

It works now when I use the “for each row” activity. Thanks!
Out of curiosity, why does the message box work without using “for each row” when I specify a range in “Read Range”? Is it because of the data table is too large for a message box if I read the entire sheet?

Hi @deliateo

If you want get range “A1:U10” use Read Range Activity there you can pass range and use Output Data Table Activity there in properties you can pass input data table variable and create output string variable and after use write line pass that output of output data table
you will get data what you are expecting range.

Kommi Jeevan.

You welcome! :slight_smile:
You say that the message box show the datatable values when you set a range ?

Yes, correct.
It will show the values it has actually picked up from the Excel file in the pop up message box.

I really didn’t know that can be used in that way but it’s possible that if you don’t set a range the message box can’t handle it cause is too much data.

Welcome to uipath community
There are two options to read a workbook
First if it is a excel file then use Excel application scope and read range in it
If it is from any other workbook then use WORKBOOK activities where search as workbook in activity panel and in it choose read range activity

Both these read range would give us a output of type datatable and name that variable as dt

—now use output datatable activity and pass the above variable dt as input and get the output with a variable of type string named str_output
—then use this string variable as input to WRITELINE activity

Cheers @deliateo

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