web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Automate
Unanswered

Updating a xml file

(0) ShareShare
ReportReport
Posted on by 61

Hello, 

 

I need help with looping through an excel file and updating some values from the excel file to an xml file. 

example : excel file has testdata1, testdata2... etc in column A , I want to loop through this and take each value - testdata1, testdata2 and so on and update to an xml file. 

 

 

I have the same question (0)
  • Deenuji_Loganathan_ Profile Picture
    6,250 Super User 2025 Season 2 on at

    @Sh99 

     

    Could you please share some screenshot of your XML file(any sample) and elaborate your use case with example?

     

     

  • MichaelAnnis Profile Picture
    5,727 Moderator on at

    If you can create an XML file template, then I would do that and reference the places to populate with uniquecodes.

    Example XML:

    <FundRelationship_New>

          <ExternalSystemReferenceID>DATA~EXTSYSTEMID</ExternalSystemReferenceID>

          <Entity_Code>DATA~ENTITY</Entity_Code>

          <Sub_entity_Code>DATA~SUBENTITY</Sub_entity_Code>

          <Fund>DATA~FUND</Fund>

          <Class_Code>DATA_CLASS</Class_Code>

    </FundRelationship_New>

     

    Then my Excel data could be:

    EXTSYSTEMID ENTITY SUBENTITY FUND CLASS
    Transaction001 Investor001 Portfolio001 Equity001 ClassA
    Transaction002 Investor002 Portfolio002 Equity002 ClassB
    Transaction003 Investor003 Portfolio003 Equity003 ClassC

     

    PAD could loop through this, replacing text in the template for each DATA~[field].

     

    Good luck!

  • Sh99 Profile Picture
    61 on at

    Hello, 

     

    This is useful, can you share a screenshot of the code while trying to update the data in xml ? I need the screenshot of the xml command . do I use set xml element value?

     

  • MichaelAnnis Profile Picture
    5,727 Moderator on at

    My apolgies, I was going more for a simple "Replace Text" approach, but your way is better, so:

    Read from Excel

    For each row in Excel

        Read XML from file

        Set XML element value

        Set XML element value

        Set XML element value (as many as columns you have)

        Write XML to file (write to a different file, don't mess up your template)

    End for each

    For Set XML element value, mine looks a little difficult, cuz my XPath got messed up by some garbage that was in the way of the normal path:

    MichaelAnnis_0-1714151879730.png


    But there are tools to find your XPath query, or GPT should be able to help get this right.  If you have the paid GPT version, I have a PAD Assistant GPT that I made that might be able to help you.

     

    Regards,

     

    Mike

  • Sh99 Profile Picture
    61 on at

    hello, 

     

    I am not sure what to enter in the xpath query.

  • MichaelAnnis Profile Picture
    5,727 Moderator on at

    It’s supposed to be parent/child/element, but mine ended being complicated. I would share an example with GPT and ask it what it should be for the element you want to edit. 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard