Skip to main content
After your customers have imported and validated their data in Flatfile, you need to get that data to its final destination. Data egress refers to the process of extracting and transmitting data from Flatfile to external systems, files, or destinations.

Egress Methods

Since Flatfile listeners run in TypeScript/JavaScript environments, you can egress data using any mechanism available in the language ecosystem. This includes direct API calls, file generation, database connections, message queues, or any custom integration pattern your application requires.

API Transmission

Send data directly to external systems via HTTP requests to REST APIs, GraphQL endpoints, streaming services, or database APIs. Use any HTTP client library or built-in fetch to POST data to your existing endpoints.

File Generation & Download

Build files in any format - CSV, XLSX, XML, JSON, PDF, or custom formats - using the appropriate TypeScript libraries. Generate formatted reports, structured documents, or data exports that users can download directly.

File Transfer

Transmit generated files to external destinations like cloud storage, FTP servers, email attachments, or content delivery networks using the corresponding SDK or protocol library.

Example: API Egress with Workbook Actions

The following example demonstrates egressing data via HTTP POST when users complete a workbook. This pattern listens for a workbook action and sends the data to an external webhook endpoint.

Implementation

The example listener responds to workbook:submitActionFg events, retrieves all sheets and records from the workbook, and posts the data to a configured webhook URL. It uses the event.secrets() method to securely access the destination URL.

Testing with webhook.site

To test this pattern:
  1. Navigate to webhook.site and copy your unique URL
  2. Add the URL as a Flatfile secret named WEBHOOK_SITE_URL
  3. Configure a workbook action in your blueprint to trigger the egress
  4. The listener will POST the workbook data to your webhook.site URL where you can inspect the payload

Example Projects

Example: File Export with Export Workbook Plugin

For file generation and download, Flatfile provides the Export Workbook Plugin that generates Excel files from workbook data. This plugin handles the entire process of extracting data, formatting it into Excel sheets, and making it available for download.

Installation

Implementation

Workbook Configuration

Add a download action to your workbook to trigger the export:
When users click the download action, the plugin generates an Excel file containing all workbook data and either triggers an automatic download or directs users to the Files page to download manually. For complete configuration options and advanced usage, see the Export Workbook Plugin documentation.

Example: Custom XML File Generation

For custom file formats, you can build files programmatically using any TypeScript library. This example demonstrates creating XML files using the xml2js library to generate structured data exports.

Installation

Implementation

Workbook Configuration

Add an XML download action to trigger the export:
This pattern can be adapted for any file format by substituting the appropriate library and transformation logic. The key steps remain the same: fetch data, transform it, generate the file, upload it to Flatfile, and provide a download link to users.