Embedding Flatfile
JavaScript Embedding
Embed Flatfile using vanilla JavaScript
Embed Flatfile directly into any web application using our JavaScript SDK. This approach works with any framework or vanilla JavaScript setup.
Installation
Add the Flatfile JavaScript SDK to your page:
Or install via npm:
Basic Implementation
1. HTML Structure
Create a button to trigger the Flatfile embed:
2. Initialize Flatfile
3. Get Your Credentials
- publishableKey: Get from Platform Dashboard → Developer Settings
- spaceId: Create a Space in the dashboard, copy the ID from the URL
Complete Example
Configuration Options
Option | Type | Required | Description |
---|---|---|---|
publishableKey | string | Yes | Your publishable key from the Platform Dashboard |
spaceId | string | Yes | ID of the Space to load |
displayAsModal | boolean | No | Show as modal (true) or inline (false). Default: true |
Alternative: Create New Spaces
To create a new Space each time instead of reusing an existing one:
- Remove the
spaceId
parameter - Add a
workbook
configuration object - Optionally add
listener
for custom data processing
For detailed workbook configuration, see the Workbook API Reference.
Next Steps
- Styling: Customize the embedded experience in your Platform Dashboard Space settings
- Data Processing: Set up Listeners in your Space for custom data transformations
- API Integration: Use Flatfile API to retrieve processed data
- Advanced Configuration: See @flatfile/javascript documentation