Adds an Import button to the list view of selected collections that opens a drawer guiding the user through upload, preview, field mapping, validation and import. It is configured by listing collection slugs in the plugin options and exposes a POST import endpoint. It supports CSV, JSON, Excel and TSV files and requires Payload 3.37 or newer.
This is an extended version of the Payload CMS import-export plugin, providing additional features and enhancements.
Installation
npm i payload-extended-import-export-plugin29
Stars
7
Forks
1
Open Issues
1 years ago
Last Updated
0
Weekly Downloads
v1.0.11
npm Version
380.0 KB
Unpacked Size
3
Dependencies
Trends appear after 7 days of data. Daily snapshots have not started yet.
Trends appear after 7 days of data. Daily snapshots have not started yet.
Each point is npm's rolling 7-day download count.
Health Score
Composite score based on GitHub activity, stars, npm downloads, publish recency, dependency count, and package size.
Badge for your README
[](https://payloaddirectory.dev/plugins/1030244052-root)<a href="https://payloaddirectory.dev/plugins/1030244052-root"><img src="https://payloaddirectory.dev/badge/1030244052-root.svg" alt="Payload Directory"></a>README
An extended import and export plugin for Payload CMS with additional features and enhancements.
Install the plugin via npm or pnpm:
npm i payload-extended-import-export-plugin
or
pnpm add payload-extended-import-export-plugin
Add the plugin to your payload.config.ts:
import { payloadExtendedImportExportPlugin } from 'payload-extended-import-export-plugin'
export default buildConfig({
plugins: [
payloadExtendedImportExportPlugin({
collections: ['posts', 'users', 'pages'], // Specify collections for import
enabled: true,
}),
],
})
The plugin accepts the following configuration options:
collections (required)CollectionSlug[]enabled (optional)booleantruepayloadExtendedImportExportPlugin({
collections: ['posts', 'users', 'pages'], // Enable import for these collections
enabled: process.env.NODE_ENV !== 'production', // Disable in production
})
The plugin adds an "Import" button to the list view of enabled collections. Clicking this button opens a drawer with the import interface that guides you through the import process:
This plugin is built with:
To set up the development environment:
# Clone the repository
git clone https://github.com/saroroce/payload-extended-import-export-plugin
# Install dependencies
pnpm install
# Set up environment variables
cd dev
cp .env.example .env
Environment Configuration:
Create a .env file in the dev folder with the following variables:
# Database connection string
DATABASE_URI="mongodb://localhost:27017/payload-import-export-dev"
# Payload secret for JWT tokens
PAYLOAD_SECRET="your-secret-key-here"
# Optional: Email configuration for testing
EMAIL_FROM="[email protected]"
EMAIL_FROM_NAME="Payload Import Export Plugin"
Important Notes:
DATABASE_URI to match your database setup (MongoDB, PostgreSQL, etc.)PAYLOAD_SECRETdev/payload.config.ts# Start development server
pnpm dev
The development server will be available at http://localhost:3000.
// payload.config.ts
import { payloadExtendedImportExportPlugin } from 'payload-extended-import-export-plugin'
export default buildConfig({
collections: [
{
slug: 'posts',
fields: [
{ name: 'title', type: 'text', required: true },
{ name: 'content', type: 'textarea' },
{ name: 'status', type: 'select', options: ['draft', 'published'] },
],
},
],
plugins: [
payloadExtendedImportExportPlugin({
collections: ['posts'], // Enable import for posts collection
enabled: true,
}),
],
})
payloadExtendedImportExportPlugin({
collections: ['posts', 'users', 'pages'],
enabled: process.env.NODE_ENV !== 'production', // Disable in production
})
For a posts collection, your CSV might look like:
title,content,status
"My First Post","This is the content of my first post",published
"Draft Post","This is a draft post",draft
"Another Post","More content here",published
The plugin includes comprehensive tests to ensure reliability:
# Run integration tests
pnpm test:int
# Run end-to-end tests
pnpm test:e2e
# Run all tests
pnpm test
interface PayloadExtendedImportExportPluginConfig {
collections: CollectionSlug[] // Required: Array of collection slugs
enabled?: boolean // Optional: Enable/disable plugin (default: true)
}
The plugin exposes an import endpoint at /api/import that accepts:
POSTmultipart/form-dataImport button not visible:
collections arraypayload.config.tsFile upload errors:
Import validation errors:
Contributions are welcome! Please feel free to submit a Pull Request.
MIT License - see LICENSE file for details.
If you encounter any issues or have questions, please:
payload plugin import export
Import and export collection data as JSON or CSV files from the Payload admin
350/wk23v3
payload exportcollections plugin
Export collection data to CSV or JSON from buttons in the admin list view
320/wk40v?
import export
Import and export Payload collection data
9725.9k/wk45.4kv3
payload portable plugin
Export and import all Payload collections and globals as a single JSON file from the admin panel
400/wk0v3
payload wordpress
WordPress MySQL database adapter and migration tool for moving content into Payload with PostgreSQL
135v3
redirects
Manage internal and external redirects from a dedicated collection in the Payload admin panel
100105.3k/wk45.4kv3