Harllens George | 2026-03-23

File Exporter PCF for Power Apps Canvas Apps

This guide shows a practical way to handle Power Apps file export PCF scenarios in Microsoft Power Platform. The component takes one JSON payload with one or more documents, then either downloads the files in the browser or exposes a structured output that you can pass to Power Automate, SharePoint, or another storage flow.

The main value is simple: makers can stay inside Canvas Apps, define documents in JSON, and choose whether the export happens immediately in the browser or downstream in automation.

What this component is

This is a PCF control for Power Apps Canvas Apps that prepares text-based files from documentsJson. It validates each entry, computes metadata, builds a base64 output per file, and supports three delivery modes:

  • Disabled, output only, no direct browser download
  • Zip, one archive download
  • Separate, one browser download per valid file

Who this is for

  • Power Platform makers building export features in Canvas Apps
  • Teams that need a reusable file export pattern without writing custom browser logic
  • Projects that want to hand generated files to Power Automate or SharePoint

Get it

Compatibility

  • Microsoft Power Platform
  • Power Apps Canvas Apps
  • Power Automate or SharePoint flows when browser download is not the final step
  • Text-based export payloads such as CSV, TXT, JSON, XML, HTML, Markdown, or SQL

Why this matters

File export is common in business apps, but the implementation usually gets scattered. One screen builds CSV, another triggers a Flow, and another tries to download multiple files with fragile custom logic.

This component gives you a cleaner contract:

  • One JSON input for all document definitions
  • One PCF control that handles validation and output shaping
  • One output JSON that can be consumed by Power Fx or a Flow

That is useful when you want a repeatable export pattern across multiple apps.

Common use cases

  • Export CSV or TXT files directly from a Canvas App
  • Generate JSON payloads and store them in SharePoint through Power Automate
  • Let users download one ZIP instead of many separate browser files
  • Keep download disabled in the UI but still prepare files for external systems

How the component works

At a high level, the flow is straightforward:

  1. Provide a JSON array to documentsJson.
  2. Each object defines one file with fileName, fileExtension, mimeType, and contentText.
  3. The component validates each document and exposes the result through documentsOutputJson.
  4. You choose whether to:
    • keep the files inside the app outputs,
    • download them as a ZIP,
    • or attempt separate browser downloads.

Minimal JSON example

[
  {
    "id": "doc-001",
    "fileName": "customers",
    "fileExtension": "csv",
    "mimeType": "text/csv",
    "contentText": "Id,Name,Country\n1,Ana,DE\n2,John,US\n3,Mika,JP"
  },
  {
    "id": "doc-002",
    "fileName": "notes",
    "fileExtension": "txt",
    "mimeType": "text/plain",
    "contentText": "This is a simple text file.\nSecond line.\nThird line."
  }
]

Screenshots

Component preview in Canvas Apps

File Exporter Component preview in a Canvas App.

documentsJson input

Documents JSON input property for the File Exporter Component.

Download mode selection

Download mode property showing Disabled, Zip, and Separate modes.

documentsOutputJson output

Processed documents output JSON from the File Exporter Component.

Output and status properties

Output properties for validation, click state, and processed files.

Which download mode to use

Disabled

Use Disabled when the control should only prepare the files. This is the safest option when SharePoint, Power Automate, or another external system should store the result.

Zip

Use Zip when you want one reliable browser download. In practice, this is the best built-in option for users who expect one click and one file.

Separate

Use Separate when you explicitly want one download per file. This is best effort because browser or host policies can limit multiple downloads.

How to use it in Canvas Apps

  1. Import the solution into your environment.
  2. Add the control to a Canvas App screen.
  3. Bind documentsJson to a JSON string.
  4. Set downloadMode based on the user journey:
    • Disabled for output-only flows
    • Zip for one archive
    • Separate for individual files
  5. Read documentsOutputJson, isValid, validDocumentCount, or downloadResultJson in Power Fx.

Parse the output JSON in Power Fx

If you want to work with the processed output inside the app, parse documentsOutputJson into a collection.

ClearCollect(
    colDocs,
    ForAll(
        Table(ParseJSON(FileExporterComponent1.documentsOutputJson)),
        {
            id: Text(Value.id),
            fileName: Text(Value.fileName),
            fileExtension: Text(Value.fileExtension),
            fullFileName: Text(Value.fullFileName),
            mimeType: Text(Value.mimeType),
            contentText: Text(Value.contentText),
            base64: Text(Value.base64),
            sizeBytes: Value(Text(Value.sizeBytes)),
            isValid: Boolean(Value.isValid),
            errorMessage: Text(Value.errorMessage)
        }
    )
)

This is useful when you want to show a confirmation screen, filter valid documents only, or pass the final payload to a Flow.

SharePoint and Power Automate pattern

One of the most practical uses of this component is storing generated files outside the browser.

Recommended pattern:

  1. Set downloadMode = Disabled.
  2. Wait for the control to update documentsOutputJson.
  3. Send that JSON string to Power Automate.
  4. Use Parse JSON in the Flow.
  5. Loop over the documents.
  6. Convert each base64 field to binary.
  7. Create files in SharePoint or another target system.

This gives you a stable handoff between the app UI and the storage workflow.

Important properties and outputs

Useful inputs:

  • documentsJson
  • downloadMode
  • archiveFileName
  • displayModeInput
  • button styling inputs

Useful outputs:

  • documentsOutputJson
  • downloadResultJson
  • documentCount
  • validDocumentCount
  • isValid
  • errorMessage
  • lastAction
  • changeToken
  • selectToken

Common mistakes to avoid

  • Using Separate mode for critical multi-file delivery, ZIP is usually more reliable.
  • Expecting the control to upload files directly, it prepares outputs but does not store files by itself.
  • Forgetting to validate isValid and errorMessage before sending data to Flow.
  • Using browser download when the real requirement is SharePoint storage, use Disabled plus documentsOutputJson instead.

Next steps

  • Start with one simple CSV or TXT export.
  • Decide whether users need ZIP download or an external storage flow.
  • Add a Power Automate handoff if SharePoint or another backend should own the files.

Conclusion

If you need a Power Apps file export PCF pattern for Microsoft Power Platform, this component gives you a practical base: JSON in, validated files out, and a clear choice between browser download and automation handoff.