@afzalimdad9/payload-import-export
v3.70.11
Published
Import-Export plugin for Payload
Downloads
1,258
Maintainers
Readme
Payload Import/Export Plugin
A comprehensive plugin for Payload to easily import and export collection data in CSV and JSON formats.
Features
Export Functionality
- Export collection data as CSV or JSON
- Download exports directly or save as file uploads
- Selective field and document export
- Support for nested objects and relationships
- Jobs queue integration for large exports
- Customizable CSV output formatting
Import Functionality
- Import data from CSV or JSON files
- Data preview and validation before processing
- Support for creating new documents and updating existing ones
- Comprehensive error handling and reporting
- Progress tracking and status updates
- Automatic type conversion and nested object handling
Quick Start
pnpm add @afzalimdad9/payload-import-exportimport { buildConfig } from 'payload'
import { importExportPlugin } from '@afzalimdad9/payload-import-export'
export default buildConfig({
plugins: [
importExportPlugin({
collections: ['users', 'posts'], // Optional: specify collections
}),
],
// ... rest of config
})Documentation
Configuration Options
| Option | Type | Description |
| -------------------------- | ----------------- | ------------------------------------------------------ |
| collections | string[] | Collections to enable import/export for (default: all) |
| disableImport | boolean | Disable import functionality |
| disableDownload | boolean | Disable direct download of exports |
| format | 'csv' \| 'json' | Force specific format and hide format selector |
| overrideImportCollection | function | Customize the import collection configuration |
| overrideExportCollection | function | Customize the export collection configuration |
Usage
Exporting Data
- Navigate to any collection list view
- Use the "Export" option in the list controls
- Configure export settings (format, fields, filters)
- Download directly or save as file upload
Importing Data
- Navigate to any collection list view
- Use the "Import" option in the list controls
- Paste CSV or JSON data into the import form
- Preview and validate the data
- Process the import with progress tracking
CSV Format Support
The plugin handles complex data structures in CSV format:
- Nested objects:
user.profile.name→{ user: { profile: { name: "value" } } } - Arrays:
tags.0,tags.1→{ tags: ["value1", "value2"] } - Relationships: Supports ID references and basic validation
API Endpoints
POST /api/exports/download- Direct export downloadPOST /api/imports/preview- Preview import dataPOST /api/imports/process- Process import
License
MIT - see license.md
