cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Fahd
New Member

Export data from a gallery of power apps to Word

Hi,

I would like to export data from a gallery to a Word document.
I watch the below video but it does not cover for gallery data.

https://m.youtube.com/watch?v=tyDU9bxA0L0&t=1140s

 

Thank you

1 ACCEPTED SOLUTION

Accepted Solutions

Hi Fahd,

You'll need to create a one-row table in your Word template with a 'Repeating Section'. Each field in this row will have a 'Plain Text Content Control'. 

NuttyPistons_0-1636144437982.png

Once you have this table in your template, highlight the entire row (including all of those 'Plain Text Content Controls') and select 'Repeating Item Content Control':

NuttyPistons_1-1636144509560.png

 



Select Properties and Title and Tag this as 'Rows':

NuttyPistons_2-1636144591888.png

Now you need to pass the data from your gallery to Power Automate as a JSON table. The code in PowerApps for this should be:

JSON(
    Filter(
        'Fiche de saisie', Statut.Value = "Approuvé", Debut >= DatePicker3Debut_3.SelectedDate, Fin <=         DatePicker3Fin_3.SelectedDate
    ), JSONFormat.IndentFour
)

In your flow:

1. Initialize a variable as a string - Ask in PowerApps (this will be above code)

2. Create step "Parse JSON"

        Content - string variable from #1 above
        A cheat for this is to just put this into 'Generate from sample' --> {"test": "test"}
        Run your flow once. It will fail but you will get a sample of the payload. Go into the failed flow run and copy the 'Content' from INPUTS. This is a sample payload you can now add to your Parse JSON step using the 'Generate from sample' button at the bottom.

3. In your 'Populate a Microsoft Word template' step, you should see several fields that being with 'Rows' (which is what we named the 'Repeating Item Content Control'. Click the "T" in a square in the top right of that area to switch to 'input entire array'. Here, we will use 'Body' from your Parse JSON step.

 

You will need to re-link your flow to your app, and add the JSON code above to pass your gallery data to the flow.


With more details on your data I could create a sample but hopefully this helps.

     

View solution in original post

5 REPLIES 5
v-JessicaG-msft
Community Support
Community Support

Hi @Fahd,

 

Do you want to export gallery data to word?

 

Could you explain in more detail how you set up the Gallery?I tested a single control in powerapps, and the results can be exported normally.I have test for your reference,please try the following workaround:

vJessicaGmsft_0-1636363014849.png

vJessicaGmsft_1-1636110821768.png

 

Best Regards,
Jessica Gu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-JessicaG-msft ,

Yes, I would like to export a gallery data to Word.

In my app, I have a gallery named "gallery12" that displays data depending a selected period with a filter .

My purpose is to export the data selected to a table of Word . Below a capture of my gallery.

 

Fahd_1-1636142808858.png

I hope you have more details.

Thank you

Best regards

 

Hi Fahd,

You'll need to create a one-row table in your Word template with a 'Repeating Section'. Each field in this row will have a 'Plain Text Content Control'. 

NuttyPistons_0-1636144437982.png

Once you have this table in your template, highlight the entire row (including all of those 'Plain Text Content Controls') and select 'Repeating Item Content Control':

NuttyPistons_1-1636144509560.png

 



Select Properties and Title and Tag this as 'Rows':

NuttyPistons_2-1636144591888.png

Now you need to pass the data from your gallery to Power Automate as a JSON table. The code in PowerApps for this should be:

JSON(
    Filter(
        'Fiche de saisie', Statut.Value = "Approuvé", Debut >= DatePicker3Debut_3.SelectedDate, Fin <=         DatePicker3Fin_3.SelectedDate
    ), JSONFormat.IndentFour
)

In your flow:

1. Initialize a variable as a string - Ask in PowerApps (this will be above code)

2. Create step "Parse JSON"

        Content - string variable from #1 above
        A cheat for this is to just put this into 'Generate from sample' --> {"test": "test"}
        Run your flow once. It will fail but you will get a sample of the payload. Go into the failed flow run and copy the 'Content' from INPUTS. This is a sample payload you can now add to your Parse JSON step using the 'Generate from sample' button at the bottom.

3. In your 'Populate a Microsoft Word template' step, you should see several fields that being with 'Rows' (which is what we named the 'Repeating Item Content Control'. Click the "T" in a square in the top right of that area to switch to 'input entire array'. Here, we will use 'Body' from your Parse JSON step.

 

You will need to re-link your flow to your app, and add the JSON code above to pass your gallery data to the flow.


With more details on your data I could create a sample but hopefully this helps.

     

Hi all,

First I am sorry to take a long time to respond you. I would like to thank you for your repsonses especially for @NuttyPistons  that helped me a lot. And the below video also helped me to understand Json. Thank you.

https://www.youtube.com/watch?v=ozhIlkETwvc

 

Hey Nutty,

 

what is the content of the schema of "Parse Jason" in your example? I dont know, how to reference the content of the gallery to the datafield of word. I know that I have to tip in:

{

"dataFieldWord"="fieldOfGallery"

}

But I dont know what to put in to fieldOfGallery

 

Would be very happy to hear from you. 🙂

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power Automate Designer Feedback_carousel.jpg

Help make Flow Design easier

Are you new to designing flows? What is your biggest struggle with Power Automate Designer? Help us make it more user friendly!

Top Solution Authors
Top Kudoed Authors
Users online (3,461)