How to write Generated DataTable to Excel

datatable
excel
ocr
activities

#1

Hi everyone,

I’m trying to read a scanned PDF with OCR and then transfer the data to excel. So far the screen scrapper in Desktop Recorder was able to read the line items I selected in a specific area in the PDF well. Also, from within the same scraper window I was also able to generate a table with the appropriate line separator. This recording is saved and the sequence seems to be created well in Studio.

From the studio, and to move the DataTable to excel, I tried the following:

  1. Added the activity (Workbook - Write Range) and specified an xls output file. Workflow runs, but xls output file remains empty.
  2. Added an Excel Application Scope and a Write Range activity. Workflow runs, and xls output file also remains empty.

So yeah, in both cases the output is not there.

What am I missing here?

:blush:

Thank you,
Hakuna Matata


#2

Hello

Are you storing the data into a datatable variable?

You should use “Output Data Table” to store it to a string, then use a Message Box or something to output the data. This will verify there is data there (for testing).

If you could provide more details or screenshots that would also be helpful for those exploring the forums like me.

Thanks.


#3

Hi ClaytonM,

Yes, the generated data table is stored in a Datatable variable and the scope is set right.

I just added ‘Output Data Table’ and a Message Box, after run the message box appeared empty. So probably something is off in the previous step. Here’s an image of the screen scrapper window showing the text and the table that is expected to be generated:

What do you think?

Thanks,
Hakuna


#4

Cool,
Since you are using Screen Scraping, you probably need the text to be on the screen when it runs. If that’s not the problem you could also try “Read PDF with OCR” activity then Generate Data Table can convert it to your datatable, however I have issues with that activity.


#5

Hi Clayton,

The file is on screen.

‘Read PDF with OCR’ reads the whole document, or a range of pages, or a single page, but not a specific area on a page. Considering that I’m dealing with a specific area on a scanned ‘image’ PDF hence I’m looking for a way to somehow work out the original model (i.e. screen scraping the area and generating a datatable then writing the datatable to an excel).

It would be really great if someone could help me with this one :sweat_smile:

Hakuna


#6

Hi,
Looks all fine for me.
How about just put Datatable.Rows.Count.tostring in message box to check is there any data.
Meanwhile just do screen scraping with web page/other application and see the output.


#7

Hi,

So after a few more attempts, it appears that the screen scrapping in UIPath is not scraping data from any document, even the most basic example PDF with just a few lines of machine readable text.

Following your suggestions, I’ve tried to read the same PDFs in another screen scrapper and it worked just as expected.

Having that said, our expectation is that we would be able to do good screen scrapping with UIPath. It considerably beats the purpose to use another app for scrapping while we are approaching a robotic process automation operation.

Hoping this gets sorted out.

Hakuna


#8

Hi, I am also facing the same type of problem, instead of reading from PDF, my requirement is to read the data from Web, the tabular data, it used ot read before, somehow it is not working and not knowing where i made a mistake, i have followed all the steps as above.
As i said it worked before surprisingly. Now it is not working with the same code.
Any suggestions on this.

-Thx


#9

Hello, still i could not resolve this issue. is there any suggestions in this part, looking for an appropriate solution
Hoping will get the solution

Chandra


#10

Hello @csmuvvala,

If you wants to extract tabular data, do data scraping.