Object reference not set to an instance of an object: write range


I have used a get text function to copy text from a pdf, then changed that variable to type DataTable and now I am trying to enter that value into an excel doc with a write range function

why am I getting this error message when the write range activity runs?

We need to see more of your process, but this occurs when something is empty as you try to use an object…

How are you converting variable to DataTable?
Are the values in the DataTable correct?

I think that is the problem. how do i convert the variable to data table? after I made it in the get text activity I just manually set it to be the data table type.

and yes I think it is this problem that is causing the data table to be blank

@josh.cusack - oh you will not be able to just convert to datatable.

You will have to use Build Data Table activity to build your datatable, using data from the PDF.

It looks to me you should not be using Write Range, but just a Write Cell, if you have only a get text…

@bcorrea - write cell will put all content in one cell, no?

yes, but you said you used a Get Text, so you have only one value…

@bcorrea - I didn’t say that :smile:

@josh.cusack - if the PDF is structured data, you can do a data scrape, build your data table and pass the scraped data to the data table.
If it is unstructured data, you will have to parse the text, and then pass correct values to the data table.

I have used a get text function to copy text from a pdf

The table is unfortunately unsupported by uipaths scraping function but its not that big so I was going to grab the pieces I need one at a time since they won’t be moving around the page. and write cell worked for the generic value type and that is all I needed since, yes it was one value.
Thanks guys

Then you just need to use Build Data Table activity and then for every row you want, use add data row, filling the ArrayRow property in this format: {value1,value2,value3}, but still it this is only one row, maybe you just want to use Write Cell for every cell you want to write…

I am reading an excel, grabbing data from one of the sheets into a data table, modifying the data, and attempting to write it back into the same sheet. I am receiving the Object reference not set to an instance of an object" error.

Hi, welcome to the community!
This error is very common and too general for us to be able to help without more details, it happens when you try to use an object that has not being initialized. If you still in trouble with it, open your own post so others can help you better.