Get xml element match excel file

I have folder invoice xml, can get element Serial No., Invoice No., Invoice Date. from xml file but
how i can match O column (Item Name) to find Serial No., Invoice No., Invoice Date type into excel.

i have original excel file

VIE040.xlsx (10.7 KB)
Read Multiple XML.xaml (19.8 KB)

I want get
item.Elements(“TTChung”).Elements(“KHMSHDon”).Value.ToString → (1)
item.Elements(“TTChung”).Elements(“KHHDon”).Value.ToString → (C22TBV)
item.Elements(“TTChung”).Elements(“SHDon”).Value.ToString → (405)
item.Elements(“TTChung”).Elements(“NLap”).Value.ToString → (07/06/2022)
After match O column with xml file to find Serial No., Invoice No., Invoice Date.

There are different strategies. one of them could be:

  • iterate over all XMLs and create a helper Dictionary - dictCodeToFileLK:
    • Key = the Code like DJ247-…)
    • Value = the XML Filename / FilePath

Therefore we retrieve the value from the THHDVU element and extracting the code with the help of regex by:
grafik

With the help of the Helper Dictionary we can update the excel

  • For each row

  • extract from O the code
    grafik

  • check with dictCodeToFileLK.ContainsKey(strTestCode) if the code is known

  • if it is found - Then: open XML, retrieve the values and update the row

Above description is a starter help (we also gave you some help on your other topic). The presented samples also let some questions open:

  • why not using the AB col where we do have the code?
  • is the pattern for the code reliable? Currently we also do see the case of 5203 which is different

Once you have redefined all these requirements we also can check for optimizations. However, just do a start as described.

  • why not using the AB col where we do have the code?
  • AB col get from O col by: system.Text.RegularExpressions.regex.Match(row(“Item Name”).ToString, “([A-Z]+\d+-\d+)”).Groups(1).Value
  • is the pattern for the code reliable? Currently we also do see the case of 5203 which is different
  • Yes we have some code i need match
    Dung môi (DTR 03039)
    Dung môi (SQS5203)
    Dung môi (NP CCL UNIVERSAL THINNER-200L)
    Dung môi (#275(SC))
    Becker Paint (DJ247-66261)

Sorry, I just learn Uipath & do this project, the truth is I can’t fully understand what you mean.
Now i save tag xml to excel, match “Invoice” column
image
Compare with original excel.


But get tag element xml not correct,

Can you view my xaml and teach me by workflow. Thank so much
Read Multiple XML.xaml (23.6 KB)

its better to do small steps and to explore the building blocks, just retry with first

iterate over the XMLs
read the code
add it to a dictionary

just try to let not much questions open. With some sample xml fiels we also can help you on those parts

1 Like