Showing results for 
Search instead for 
Did you mean: 
Post Prodigy
Post Prodigy

How create a table in XML and add data dynmically from collection or gallery?

Hi Experts, 

I have been working on some functionality where we can achieve or transfer the data using XML as you all know it's more convenient and fast to transfer data for certain old software application do not support JSON. 

However, I have a requirement, when I would like to create an XML file, using the data entered in powerapps. So far I have figured out how and what ways can this be achieved but one thing is missing or I do not know how can this be resolved. 

I would like to add the data to the XML table dynamically from the collection/gallery. such that if there are 5 rows in the gallery it takes data from the gallery and adds it to the XML. I know this can be achieved in HTML by using Concat/Concatenate function but is there a similar way for XML too? if not how can this be achieved any idea? 

Thanks a million for taking the time to read the long post and helping me out. 

Please find the  code below:

      <Division code= "& """001""" &" />
      <Description> "& Concatenate(
        &" </Description>
      <Date>  "& Text(
             &" </Date>
      <DocumentDate>"& Text(
                "[$-en-GB] yyyy-mm-dd")
             &" </DocumentDate>
      <Journal code="& """501""" &" type = "& """I""" &"/>
      <Costcenter code= "& Concatenate( """" , ExportUnitCode.Text , """") &"/>
      <Costunit code= "& """D001""" &" />

          <FreeNumber number=""4""> "& "16002" &" </FreeNumber>

        <Currency code= "& """EUR""" &" />
        <Value> "& Text(ExportWeeklyTotal.Text) &" </Value>

      <FinEntryLine type= "&  """N"""   &" subtype= "& """T""" &" number= "& """1""" &">
        <Date> "& ExportP_Date.Text &" </Date>
        <GLAccount code="& Left(
            ) &"/>
        <Description>"& ExportDescription.Text &"</Description>
        <Costcenter code="& Concatenate( """" , ExportUnitCode.Text , """") &" />
        <Costunit code= "& """D001""" &" />
        <Creditor code= "& Concatenate( """" , ExportCreditorNo.Text , """") &" />
            <FreeNumber number= "& "4" &" >"& "16002" &"</FreeNumber>

          <Currency code="& """EUR""" &"/>
          <Debit> "& ExportDayTotal.Text &" </Debit>
          <Credit>"& "0" &" </Credit>
          <VAT code="& """0""" &" />

          <InvoiceNumber>"& "123654" &" </InvoiceNumber>

          <YourRef>"& "RCT 114" &" </YourRef>
          <DocumentDate>"& Text(
                "yyyy-mm-dd") &"</DocumentDate>

        <DocumentAttachment publish= "& """0""" &">
            <DocumentType number="& """7""" &"/>
                <Subject> "& "Invoice Name.pdf" &" </Subject>
                <Division code= "& """001""" &"/>
                    <Creditor code="& """2084""" &"/>
            <OurRef>"& "1636539" &"</OurRef>
            <YourRef>"& "RCT 114" &"</YourRef>
                <FreeNumber number= "& """4""" &"> "& "16002" &"</FreeNumber>
                <Name> test.pdf </Name>
                        Add attachment code here (base64)


Community Champion
Community Champion

Hi @Tapesh


As per knowledge, There is no way to create XML other than concatenating that already you are doing. So you are on the right track.


Super User
Super User

A suggestion for doing this:

  • Before you create your main XML file, do a ForAll on the AllItems of your gallery to generate a string with the appropriate XML tags. Put that string into a variable.
  • As you create the rest of your XML file, you can concatenate your new variable into the rest of the XML string

Here's another post referencing the difficulty of working directly with XML in PowerApps: 

Help the community help more users by choosing to "Accept as Solution" if this post met your needs. If you liked the post and want to show some appreciation, please give it a Thumbs Up.

Helpful resources

UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (2,814)