Author Details

avatar-teacher

Evolvous

We are a team of tech enthusiast and this section is where we love to share our experience and our knowledge. We try our best to help you understand technical topics by giving you live instances of how-to’s, guides, tips, FAQ’s and troubleshoots.

If you like it or have questions, do share your feedback in the comments section below.

Export Excel in PowerApps

Introduction:

In this blog “Export excel in PowerApps”, you will learn how to download an Excel file from Power Apps data using Power Automate flows. We will cover creating CSV table, passing parameters from PowerApps to flow and download locally.

Required:
Solution:
  • SharePoint: Create a SharePoint list.

PowerApps: Take a gallery control and set the data source as SharePoint list (or else take as per your requirement). Also Place an icon to download the excel from PowerApps.

Export Excel in PowerApps - Evolvous

Now apply the below code to icon “OnSelect” property.

“OnSelect” property Export excel in PowerApps - Evolvous

Clear(ColExportData);
Notify("Exporting CSV..",NotificationType.Information);
ForAll(GalRFI.AllItems,
Collect(ColExportData,
{Number: ThisRecord.Number,
Subject:ThisRecord.Subject,
Status:ThisRecord.Status.Value,
Assignees:Left(Concat(ThisRecord.Assignees,DisplayName & ","),Len(Concat(ThisRecord.Assignees,DisplayName & ",")) -1),
RFIManager:ThisRecord.'RFI Manager'.DisplayName,
ResponsibleContarctor:ThisRecord.'Responsible Contractor'.DisplayName,
ReceivedFrom:ThisRecord.'Received From'.DisplayName,
DateInitiated:Text(ThisRecord.Created,"yyyy-mm-dd"),
DueDate:ThisRecord.'Due Date',
ClosedDate:ThisRecord.'Closed Date'
}
)
);
Set(LaunchLink,'SBEnergy-RFI-ExportCSV'.Run(JSON(ColExportData,JSONFormat.IncludeBinaryData)).varlink);
Launch(LaunchLink);

Power Automate: Created a flow “SBEnergy-RFI-ExportCSV” using below actions.

Power Automate: Created a flow “SBEnergy-RFI-ExportCSV” using below actions. Export Excel using PowerApps - Evolvous

Action 1: PowerApps: It is PowerApps trigger which triggered from PowerApps.
Action 2: Json Data (Compose action in flow. Renamed as Json Data): Pass the JSON data from PowerApps.

Export Excel in PowerApps - Evolvous

Action 3: Parse Json: Take the output from compose action and pass to this action.

Action 4: Create CSV Table: Create this action by using the body of Parse Json and its values.

Create CSV Table - Evolvous

Action 5: Create File (Create file action of OneDrive): Create a file using OneDrive connector by passing the output from previous action.

Action 6: Create Share Link: Crate this action from OneDrive and pass the ID from “Create file” action.

Create Share Link - Evolvous

Action 7: Respond to a PowerApps or flow: pass the “Web URL” from “Create Share Link” action. And append “?Download=1” and pass that value to “VarLink

    • You can download the excel file from PowerApps by using below two lines of code

    Set(LaunchLink,'SBEnergy-RFI-ExportCSV'.Run(JSON(ColExportData,JSONFormat.IncludeBinaryData)).varlink);
    Launch(LaunchLink);

Conclusion:
Finally, you will see below CSV format once click on icon in PowerApps.