While automating the excel I am getting the error for object reference

Hello @Lahiru.Fernando sir,

I want to get the date matched with my system’s current date, for birthday automation emailers.
While automating excel from UIpath, I am getting the following error .
Provided : I am using libre office instead of excel workbook

→ Read Range , For each-loop

Please find the attached snapshot

Hi @sachinl,

DataTable seems to be Null. Do you have any value in Datatable?

Also, for spreadsheet other than MS Excel, try using “Workbook Read Range Activty”.

image

This kind of error appears when the object is null, please be sure that dt variable is not null, and if you have 3 columns in that excel (the counter for columns starts at 0).

Hello @Vivek_Arunagiri

Please find the snapshot,

I am using read range only sir.

You have specified Range as “A1:A2”. Is there any values in A1 and A2 ?

Also you need to remove Add headers checkbox.Since you have specified only one row, it will be considered as headers and there wont be any value for rows.

You’re reading 2 rows, and 1 column, and try to output the value from 3rd column. That’s the issue.

1 Like

@Vivek_Arunagiri sir A1:A2 are the name of sheet right ?
And it says from A1 to A2 ??

No its not sheetname. It is Range of cells that you need to extract, Just give it as “A1”. So that “A1” will be considered as starting range.

Or else leave it blank.

image

@sachinl

It’s not sheet name.

Here, “A1:A2” refers to starting and ending cell. It will read data from cell A1 to A2. If you specify empty quotes " " then it will read entire sheet.

@Vivek_Arunagiri Sir I have made this change:

But now it is showing

Be sure that Sheet1 is the name of the sheet in excel, and also, instead of “A1” type “”

Check if the sheet exist in excel with name as “Sheet1”

image

Now it is showing the same error for object reference .

@Vivek_Arunagiri → Yeah this is “Sheet1”

Be sure that you have a 3rd column in the excel.

Have you tried giving Range as blank ?

Also, if possible please send the screenshot of that excel.

I have 6 column in my workbook…

In the read range activity, in properties, pass dt to output

No range is “A1”…

Excel snapshot

@sachinl

You have to store the output of Read Range activity in variable of type Data type. But you didn’t store in any variable.

First store output in dataTable then pass same to For Each Row activity to iterate the data.

1 Like