How to write the extracted regex data in excel

Hi,
I’m done an invoice extraction using regex method

I’m creating three string variable
Inv No
Inv Date
Total
these variable is used to store the extracted data from pdf using regex method

I want to write the extracted data in excel, How to write in excel?

@AbarnaKalaiselvam

Use write cell activity …make surr to use it inside a use excel activity…give the cell number and the value as variable that you want yo write

Hope this helps

Cheers

Hi @AbarnaKalaiselvam ,

You could also create a Datatable using Build Datatable Activity with the 3 Columns, then use Add Data Row Activity to add the data to the Datatable. Then write the Data to an Excel sheet using a Write Range Activity.

I tried using write cell acitivity it replace the value in same cell
where to use the excel application scope, inside the foreach or outside?

@AbarnaKalaiselvam You have to use excel scope inside for each. Try incrementing the cell number once you update the value

Ex: Current values are updated in cell A1, B1, C1, next it should increment to
A2, B2, C2

I’m using inside the foreach activity, but it rewrite in A1,B1,C1

@AbarnaKalaiselvam Check the below workflow on the excel cell incrementing logic

SampleProcess.zip (2.8 KB)

Note: in the above workflow I have taken the starting cell value as 2 but you can update it in the variables panel if you need. Check below screenshot

@ushu
image
image

It write the value in cell 12 and how to add headers?

1 Like

@AbarnaKalaiselvam Before For Each you can take excel scope and write the header values in cell A1,B1,C1… using Write Cell activity. Check the updated workflow below. I hope this logic also avoids writing the data from cell12

SampleProcess.zip (3.1 KB)

1 Like

@AbarnaKalaiselvam Also, in the above screenshot of Write Cell activity you have given as "A1"+counter.ToString which is incorrect, give as "A"+counter.ToString. Please follow the attached workflow above

*First initialize a variable of type int with 1.
*After that, use Matches activity and apply the Regex expression to it.
*Use an for each activity if it contains multiple matches to iterate.
*Increment the count by +1 and use “Write Cell Activity” to print the data into excel.(In write Cell activity give the excel file path, Sheet name the cell where to write with the count variable.toString, and currentitem(since its in for each loop))

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