npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

payload-import-export

v1.1.0

Published

Import and export data for Payload

Readme

Payload Import/Export (with Import support)

A drop‑in replacement for the official Payload Import/Export plugin that adds first‑class Import support while remaining API‑compatible with the core experience.

  • Works with Payload v3
  • Same UI entry points and behavior as the official plugin
  • Adds Import alongside Export (CSV and JSON)
  • Preview data before exporting via a built‑in REST endpoint
  • Fully localized with built‑in translations

Why this package?

The official plugin focuses on exporting data. This package keeps the same ergonomics and admin UI integration, but also includes Import capabilities so you can round‑trip data between environments with minimal effort.

Installation

Install from npm and add to your Payload config. This package name is payload-import-export.

pnpm add payload-import-export
# or
npm i payload-import-export
# or
yarn add payload-import-export

Add the plugin to your payload.config.ts:

import { buildConfig } from 'payload'
import { importExportPlugin } from 'payload-import-export'

export default buildConfig({
  // ...your config
  plugins: [
    importExportPlugin({
      // Optional: limit to specific collections
      // collections: ['posts', 'users'],

      // Optional: force a format and hide the dropdown
      // format: 'csv', // or 'json'

      // Optional: control UI actions in the preview screen
      // disableDownload: false,
      // disableSave: false,

      // Optional: run exports synchronously (do not use the jobs queue)
      // disableJobsQueue: false,

      // Optional: enable debug logs
      // debug: false,
    }),
  ],
})

Features

  • Export to CSV or JSON
  • Import from CSV or JSON (drop‑in admin UI)
  • Collection‑scoped controls automatically added to the list view
  • Preview up to 10 docs before exporting
  • Select specific fields to export
  • Sort and filter using the standard Payload find options
  • Disable export/import for specific fields using field‑level flags
  • i18n: merges plugin translations into your config

How it integrates

When enabled, the plugin:

  • Adds a hidden export utility collection to track saved exports
  • Injects UI components into each collection’s list view menu
  • Registers a provider to make Import/Export state available in the admin: payload-import-export/rsc#ImportExportProvider
  • Registers a REST endpoint used by the preview UI: POST /api/preview-data

Preview endpoint

  • Path: POST /api/preview-data
  • Body:
    • collectionSlug: string (required)
    • format: csv | json
    • fields?: string[] (flattened accessors)
    • draft?: 'yes' | 'no'
    • limit?: number (preview clamps to a maximum of 10)
    • locale?: string
    • page?: number
    • sort?: Payload sort object
    • where?: Payload where object

The endpoint returns a small preview payload that the UI uses to render the table/CSV.

Import

Import runs from the same admin entry point as Export and is designed to be a drop‑in experience.

  • Supported formats: CSV and JSON
  • For CSV, headers must match flattened field accessors (e.g. title, author.id, blocks.0.text)
  • Disabled fields (see below) are ignored during import
  • Array and nested data are supported via flattened paths

Note: Import creates or updates documents according to your admin selection and mapping. Ensure your access control permits the chosen operation.

Disabling fields from Import/Export

Set admin.importExport.disable on a field to exclude it from both Import and Export. The plugin detects and hides these fields in the UI and removes them from JSON preview.

Example field config:

{
  name: 'secretNotes',
  type: 'text',
  admin: {
    importExport: { disable: true },
  },
}

Options

Provided via importExportPlugin({...}):

  • collections?: string[]
    • Limit the plugin to specific collections. Defaults to all collections.
  • format?: 'csv' | 'json'
    • Force a specific format and hide the format selector.
  • disableDownload?: boolean
    • Hide the Download button in the preview UI.
  • disableSave?: boolean
    • Hide the Save button in the preview UI.
  • disableJobsQueue?: boolean
    • Run exports synchronously instead of using the jobs queue.
  • debug?: boolean
    • Enable extra console logging.
  • overrideExportCollection?: (collection) => collection
    • Modify the internal export collection before it’s added.

Usage in the Admin UI

  • Go to any configured collection list
  • Open the “More” menu and select “Import/Export”
  • Choose JSON or CSV, pick fields, filters, sorting, etc.
  • Preview the first page of results
  • Download or Save the export, or switch to Import to upload data

i18n

This plugin ships with multiple languages and will merge its translations into your config.i18n.translations automatically.

Development (optional)

A minimal dev project lives under dev/ for local testing.

  • Copy dev/.env.example to dev/.env and set your DATABASE_URI and PAYLOAD_SECRET
  • Run pnpm dev and open http://localhost:3000

License

MIT