PDF extract to excel



HI All, I am trying to extract data from a PDF. I use read pdf and write contents to text. When I am trying to read text file and get invoice number and invoice amount, I was failed.

Anyone can help , how to read text file and split text and write to excel?
It look like this:
invoice number: 198530930
total amount: SGD 4879

i want cell A1,write"invoice number", A2 write"198530930"
B1 write"total amount", B2 write" 4879"

And split I use is :
((textData.Split(vbNewLine.ToCharArray)(counter + 2).ToString).Split(" "c)).Last

how to revise this and make it run success?
I was getting error as below.

Main has thrown an exception

Source: Write cell

Message: Index was out of range. Check that the collection has values and the index is less than the size of the collection.

Exception Type: IndexOutOfRangeException


Hi @joyozou,

After getting the value using split Environment.NewLine option spit the value to array
For loop through the array value you can get the each value.

arrvalue= strvalue.Split(Environment.NewLine.ToArray, StringSplitOptions.RemoveEmptyEntries)

arrvalue(0).ToString.Split(":")(0) ->invoice number
arrvalue(0).ToString.Split(":")(1) ->198530930

arrvalue(1).ToString.Split(":")(0) ->total amount
arrvalue(1).ToString.Split(":")(1) -> SGD 4879

Arivu :slight_smile:


Thank you Arivu! I dont know how to use environment.newline. Could I upload my flowchart and source for you to help me correct it?


This is the code strvalue is your input string


it was not work…
‘DynamicActivity’: The private implementation of activity ‘1: DynamicActivity’ has the following validation error: Compiler error(s) encountered processing expression “strvalue.Split(Environment.NewLine.ToArray, StringSplitOptions.RemoveEmptyEntries)”.
Value of type ‘1-dimensional array of String’ cannot be converted to ‘String’.


Can you send ur xaml file.

You can’t assign the string[] to string