Hi everyone, I want to export data from sql to excel using powerapps. can anyone knows on how to do that. Thank you very much.
Hi @Lyn0615,
I think here the better way is to use Microsoft Flow.
Using SQL->Get rows and then Excel->Insert Row should be able to "export " data from SQL Server to Excel.
Then add the flow into PowerApps.
Flow configuration as below:
Adding some article reference:
Besides, this could also be done only within PowerApps, but there may be some limitation when working with all data due to delegation.
We could take use of Forall and the patch function to insert the record from SQL to Excel table. Formul should be similar as below:
Forall( '[dbo].[TableName]', patch(ExcelTableName, defaults(ExcelTableName), {IdExcel:Id, ........} ) )
Please note that all the options would require Excel has a pre-defined table with the column name (better a little different from the SQL table column name) of the corrsponding SQL Table.
Some function reference:
Regards,
Michael
Hi ,
This is a great solution. But the critical issue may also be that:
We cannot often have the predefined table in Excel to export data. This may happen because we need to create one file export per filter in powerapps and send it via email as attachment, often with the filename based on the filter used.
As a workaround, we could do the following:
1. Create an excel template in a folder/one drive with all the columns to be exported .
2. Create a flow with the following steps:
3. The excel template will just be a transitory file to get SQL data and allow us to send the actual data file as attachment.
Let me know if this solution works?
Thanks,
Hi
Many thanks for your post, I've seen ForAll() elsewhere but couldn't get it to work (in a different context).
However, I stumbled accross this post while looking for a way to export SQL data to Excel.
I can now take my colllated relational data (via a collection) and then save this out to an Excel spreadsheet (connected as a data source).
Not technically an export but perfect for what I need.
Cheers
Hi @GaryEden
I have a similar requirement .
Can you share any helpful link for us to have a look at the steps you used.
I need to create an excel out of the table and views stored in SQL .
Each table corresponds to one Excel sheet.
Regards
Ayush
Hi all,
You Cannot create a table or modify the underlying structure of an existing table from within PowerApps. This is by design. The thought that a user could do that in one of my apps would keep me up nights. You can create an Excel table connect it to PowerApps and fill it with data.
Hi @Drrickryp
I understand and you are correct.
I actually need a flow which can download SQL table as an Excel.
Then I can map that Flow to a button in powerapps.
Hi Ayush
I ended up saving out to a SharePoint list and then from this list saved out to Excel.
However, when you go to clear the old data you end up hitting the 500 row limit in PowerApp - you can increase the row limit to 2000 but it gets very, very slow and sometimes that still isn't enough.
In the end I abandoned trying to export from PowerApps to Excel (or anthing else) and started using PowerBI instead. This connects to the same SQL Database and can use the same stored proceedures as PowerApps if you want (I duplicated mine as I wanted to modify them a bit). PowerBI is set to update overnight and provides loads of options to slice and dice the data with colourful charts etc. If you need to export the raw data you can do this straight to Excel with a single click.
I hadn't used PowerBI before this, but it only took a few hours to understand the basics to replicate what I was doing via the PowerApps export to Excel process i.e. Pivot Tables. Worth the investment of time and the management team love having reports at their finger tips.
Cheers
Gary
User | Count |
---|---|
125 | |
87 | |
86 | |
75 | |
69 |
User | Count |
---|---|
216 | |
181 | |
140 | |
97 | |
83 |