Object reference not set to an instance of an objec.....read ranget

When iam reading an excel using read range activity, it shows object reference not set to an instance of an object…

My excel workbook have 5 sheets and 2 of them are empty…I have to read the empty sheet and set output as zero.

How can fix this issue.can you help me

1 Like

Hi
Instead of reading the empty sheet and creating a datatable variable dt
We can use a simple assign activity like this

dt = New System.Data.Datatable

Cheers @Usha_Sree

Hi @Usha_Sree

Looks like some of the variable does not holding any values so that only you are receiving "Object reference not set to an instance of an object’ error.

You have to initialize the variable does not hold any value.

Kindly ensure all inputs are correctly passed to the activity.

Thank you.

Use try catch activity if you get an error make it as new datatable()

Regards,
Arivu

I tried but no use

Can you please share sample code/screenshot here?

Thank you.

Hi,

Based on my experience we would get this on workbook read range if we try with empty sheets. Could you confirm whether we are using workbook read range for this requirement.

If you are using workbook read range. For work around could you use excel application scope and provide input your excel and use read range inside your excel application scope and try.

And also I could see below thread resembles your issue. Please review. Thanks.

I checked it by placing it in excel application scope. It worked out. Thanks

1 Like

your welcome @Usha_Sree . Glad it worked.

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