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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / How to submit multiple...
Power Apps
Unanswered

How to submit multiple lines of data from gallery to MS Word Document?

(0) ShareShare
ReportReport
Posted on by 5

I've recently created an app on PowerApps and I need to submit multiple rows of data from my gallery into a MS Word Document


For example, the first row on my Gallery includes the following:

 

(Drop Down 1) 
 (Drop Down 2) 

(Drop Down 3) 

 (Text Input 1) 

(Text Input 2)
(Drop Down 4)

(Drop Down 5)

 (Text Input 3)

 

I have set up a flow to send the data to a Word document but only the first row of data in the gallery is transferred. I understand I may need to use a JSON but not sure how to include this.  My MS Word Document already has the 'Repeating Section Content Control' included on the rows of my table for the data

Categories:
I have the same question (0)
  • MF-12051538-0 Profile Picture
    402 on at

    Hi @OzarkOnline ,

    You will need to pass the data from your gallery to a cloud flow in Power Automate. To do this, create a new instant cloud flow and use PowerApps as the trigger:

     

    NuttyPistons_0-1643756739371.png

     

    You will likely have more variables to initialize and perhaps other steps, but this focuses on how to get your gallery lines into Power Automate as a JSON table and then how to insert that into your Microsoft Word Template.

     

    Initialize a variable of type string. For Value, select "Ask in PowerApps". This is how we will pass the data from PowerApps to Power Automate. 

     

    NuttyPistons_1-1643756862246.png

     

    Before finishing the flow, connect to this flow from Power Apps. Insert a button for calling the flow. While having the button selected, click on Action in the toolbar and then Power Automate.

     

    NuttyPistons_2-1643757019565.png

     

    A pane will open on the right which will show all available flows. Select the flow you just created.

     

    It will add "FlowName.Run(" to the OnSelect property of your button and ask for a variable to pass to Power Automate. This is where you want to pass the collection used in your gallery.

    FlowName.Run(
        JSON(
                 CollectionName,
                 JSONFormat.IndentFour
          )
    )

     

    Hit the button and run the flow.

     

    Going back to the flow, you should see a successful run of the flow.

     

    NuttyPistons_3-1643757307739.png

     

    Click on the date to open the flow run. Copy the text from Value field in the variable you created.

     

    Edit the flow. Create a new step called Parse JSON. The content will be the string variable from above. For Schema, select Generate from sample. Paste the text you copied a moment ago and hit done.

     

    NuttyPistons_4-1643757854094.png

     

     

    Create a new step called Select

     

    From is the 'Body' output from the Parse JSON step. In the Map section, enter all fields that show up in your table in the Word template as Keys (left side). The "Values" should be the corresponding field from the Parse JSON step.

    NuttyPistons_5-1643757995106.png

     

    Finally, you will add that to your Microsoft word template using the step called "Populate a Microsoft Word template". Navigate to where your file is stored, and where you come to the repeating content control, change the input method to input entire array:

    NuttyPistons_6-1643758117764.png

     

    Then use the Output from the Select step as the value:

     

    NuttyPistons_7-1643758149851.png

     

    This will generate the appropriate number of rows in the Word template.

     

    If you found this post helpful, please consider Accepting it as the solution.

  • OzarkOnline Profile Picture
    5 on at

    Hi @NuttyPistons 

     

    Thank you for your response, that really helped.

     

    I've completed the above steps but when testing my flow it fails and displays the error message on the Parse JSON step  "message""Invalid type. Expected Array but got Integer." 


    Is there any way to get around this?


    Thanks!

  • MF-12051538-0 Profile Picture
    402 on at

    If you can provide your Schema from the Parse JSON step I can take a look at what might be missing.

  • OzarkOnline Profile Picture
    5 on at

    Thank you, Here is an image of the Parse JSON stage and i've also pasted the Scheme and Outputs

    Schema:

    {
      "type""array",
      "items": {
        "type""object",
        "properties": {
          "ControlMeasures": {
            "type""string"
          },
          "Hazards": {
            "type""string"
          },
          "Likelihood": {
            "type""string"
          },
          "Likelihood2": {
            "type""string"
          },
          "Risk": {
            "type""string"
          },
          "Risk2": {
            "type""string"
          },
          "Severity": {
            "type""string"
          },
          "Severity2": {
            "type""string"
          }
        },
        "required": [
          "ControlMeasures",
          "Hazards",
          "Likelihood",
          "Likelihood2",
          "Risk",
          "Risk2",
          "Severity",
          "Severity2"
        ]
      }
    }
     
     
    Outputs
    [
      {
        "message""Invalid type. Expected Array but got Integer.",
        "lineNumber"0,
        "linePosition"0,
        "path""",
        "value"12,
        "schemaId""#",
        "errorType""type",
        "childErrors": []
      }
    ]

     

    OzarkOnline_0-1643812809035.png

     

  • MF-12051538-0 Profile Picture
    402 on at

    There's an issue with the Input to your Parse JSON step. That should be bringing in your JSON table that you passed from your collection in Power Apps, but it just has the number 12 coming in. 

    Please check the variable that you are using for Content in the Parse JSON step.

  • MJGreyling Profile Picture
    161 on at

    @NuttyPistons I'm trying to get this to work as it is exactly what I need. However, I am running into a challenge. The variable I have initialized in the flow is set as a string BUT some of the values in the collection are numbers. I am assuming this is where the problem is coming from? The error I get is: (CLPPriceVatEx is a number that is formatted in a label to display as x,xxx.xx)

    MJGreyling_0-1657543620950.png

    Any help would be appreciated.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 977

#2
Valantis Profile Picture

Valantis 664

#3
11manish Profile Picture

11manish 530

Last 30 days Overall leaderboard