Hello good people, I hope someone can help me.
I have an application developed with PowerApp where users can select multiple data attributes (columns).
Upon clicking on the "Submit" button, the app should generate an Excel file with the data of selected attributes.
I created an MS flow that makes an HTTP request and gets an array of objects. I need to generate an excel file according to the response.
Please help me to convert the JSON body to an Excel file every time the flow is triggered.
Thanks in advance.
I have modified my answer with the steps. Hope it helps.
Hi @habib6093
You can create an anonymous sharing link if your tenant has been enabled for this. See the following https://www.damobird365.com/expose-sharepoint-data-to-the-web-with-http-api
In terms of dynamic columns, an office script could deal with that scenario.
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Cheers,
Damien
P.S. take a look at my new blog here and like & subscribe to my YouTube Channel thanks 😉
HI @DamoBird365
Thank you so much for the resource you provided, but I'm still wondering how to insert data into the columns when the total column count can increase and decrease based on user input as users can select which attributes they want to see in the Excel file. For example, users want to see some fruit production in every city. In that case, each user might want to see different types of fruits. The only information I will get is a JSON response from an HTTP call. Is there any way I can generate the columns dynamically and put data accordingly from that JSON response?
Also, I'm thinking of a different approach, creating the Excel file in the backend. In that case, Is it possible to save a file in SharePoint if I return the file as an HTTP response?
Hi @habib6093
If you're looking to create an excel file, you either need a template excel file with a table (that you create a copy of) or you use Office Scripts.
You can see how to populate an excel file with an Excel script here https://youtu.be/Q7GLQnvJJF0
There's some example code here for you to try too https://techcommunity.microsoft.com/t5/microsoft-365-pnp-blog/excel-scripts-and-cloud-flows-data-manipulation/ba-p/2356956
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Cheers,
Damien
P.S. take a look at my new blog here and like & subscribe to my YouTube Channel thanks 😉
WarrenBelz
146,524
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,906
Most Valuable Professional