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!