Excel Write Range: Object reference not set to an instance of an object

Hello friends, new to Ui Path and am in need of some help please and thank you.

The issue i am having is: The workflow saves an excel file and then sends out an email. But for some reason, i am getting an error within the Write Range of this sequence and I am not sure why. Variable used: datatable


Hello @kwhites5229 ,

The Sheet, “Sheet1”, exist in your Excel file?
Is the datatable empty?

Maybe you can put some logging to get more details…

Vasile.

Hi,

Your datatable variable might be null (Nothing). How did you set value to it?

Regards,

1 Like

Sorry not sure if I am following – but in the beginning of the workflow – I have the datatable and I add a 3 columns to it. (datatable’s variable type is datatable – but the type argument here is object)

Hi,

To isolate cause, can you try to run Debug mode? We can see value of variable at Locals panel, when exception occurs and it stops.

Regards,

Hai @kwhites5229 Can you please share the xaml file, so that we can validate it. Thanks.

The file is very large – here is a screen shot of it.

I will go through debug mode. But I am not sure how to really work debug mode. As I am just learning. What should I be looking for? Thanks for your help and patience at this time J

This is working J all set here thanks

I love that you just put it’s working without telling what was the solution :nauseated_face:

I have a solution that worked for me when using the independent “Write Range” activity. I know you might have already found alternative ways, but here’s to others like you:

  1. Put “Write Range” inside a Try Catch block with Catches as “Exception”
  2. Run

For some reason, the range is still written, and the error does not appear. It’s like Write Range is both successful (writing the range) and unsuccessful (throwing an error). I’d assume this is a bug.

The Write Range Activity is legacy.
They overhauled the Excel activities quite a while back and they are waaaay more robust so I would recommend against trying to use it in 2023. If there is a bug in the Write Range I feel it would be more widespread. I think you are simply suppressing an error by basically cancelling it, which I am not a fan of, I like to understand and handle errors, not ignore them.

I agree fully. I work at an organisation where we are limited to an older version of UiPath Studio that can’t reliably make use of newer activity packages, so we don’t have any other way of circumventing this unfortunately unless you know of a way. I’m guessing that this assumed bug is not widespread because others could upgrade and it became a non-issue.

Edit: Out of curiosity, what activity/ies replaced “Write Range”? I can’t seem to find any documentation about that.

These are the modern Excel activities. I believe they all need to work in a scope now and just basically manage the instance waaaay better. I think it might be related to an addin they made which helps.

Regarding the older version of UiPath, I’m curious how old? These new Excel activities aren’t ‘cutting edge’ and have been around for a few years. Is your version is supported anymore?

We are using 2020.10.4 LTS. When we update to the newer Excel package versions, this is all we get:

image

The assumed reason is that since UiPath Studio 2022.10, the architecture of activities has changed (see here under “New Design for activities”). We also notice this if we update the System Activities to a newer version; the property panel for activities become corrupt and don’t show any editable properties.

Have you perhaps got the filters on to show only classic activities and not the modern design?
(That assuming the 2020.10.4 has modern design stuff in it).

That being said, Studio 2020.10 is ending its extended support coincidentally tomorrow.
Surely thats enough of a stick to beat your organization with to update considering the version you have is no longer supported?

Nope. I have the modern design experience so that modern activities are shown by default, and have hid classic activites.

Actually yes. I know now that an update is planned, and that we are getting the 2023 version next year. About time! There are so many activities, properties and features I have been longing to use!