Find information in folder XML (invoice)

Hello all,

This is firs time I work with XML (invoice). Now i need support :slight_smile:
I have 1file Excel have O column (4to11 character) match 1 or 2 xml file into folder a lot of file XML (invoice)

How can I find an invoice with the same information at O column and get other information in this xml to type into application

Thank you so much

1 Like

For the XML Part:
The main building block would look like this:

item = xDoc.Root.Descendants("THHDVu")

We do have multiple elements

Maybe some additional requirements are to define to enhance the retrieval

1 Like

For extracting the code we can try with regex:


1 Like

In folder xml have a lot of file xml, how I can read all to find the right file to match with excel at O Column ?

just try your first prototype by following:

arrFileNames = Directory.GetFiles(YourFolderPath,"*.xml")

Loop over the the files with a for each activity

  • open the xml
  • deserialize the xml
  • retrieve the values and check its presence

(as shown above)

Once you have done with this initial prototype then you can optimize.

Kindly note: there are several options to solve it, so we give for the first iteration a more simple to implement starter help. Let us know the result e.g. by screenshots from your modelling.

1 Like

Thank you for your support, it can run all folder & read xml element, how i can find xml match with O column excel ?

Read Multiple XML.xaml (9.1 KB)

you can add 1 more column to your datatable

then use loop to assign value to new column
CurrentRow("Invoice") = system.Text.RegularExpressions.regex.Match(CurrentRow("Item Name").ToString, "([A-Z]+\d+\-\d+)").Groups(1).Value

so this column will only contain invoice number e.g. DJ247-66241 etc.

now you can use lookup datatable to compare xml invoice number with excel invoice column

you can output rowNumber (integer), if rownumber = -1, then theres no match, otherwise rowNumber will equal the matching row

1 Like

Thank you for you support,

I added in xaml to compare Invoice & xmlInvoiceNumber to match.
Ex: row1 excel: DJ247-66261 how I get xml element in this xml files ?

VIE040.xlsx (10.5 KB)
Read Multiple XML.xaml (15.6 KB)