Newesissrl

payload exportcollections plugin

by Newesissrl
Import, export & migration
v?
Apache-2.0

Overview

Summary generated from the README

Adds export buttons to collection list views so editors can download a collection's data as CSV or JSON. It is registered through the plugins array of the mzinga config, which is a Payload fork. Options cover disabled collections, a temporary export directory, button placement, a JSON replacer and CSV options.

Features

  • Export button for CSV and JSON on collection list views
  • Disable the export for chosen collections by slug
  • Configurable component placement before or after the list or table
  • JSON replacer function to rename or omit fields
  • CSV output configurable through json-2-csv options
  • Localizable button labels via i18n resources

Use cases

  • Download a collection's records as CSV for reporting in spreadsheets
  • Export collection data as JSON for backups or transfer to other systems

From the author

Provide ability to export collections as CSV or JSON

Installation

npm i @newesissrl/payload-exportcollections-plugin

40

Stars

3

Forks

6

Open Issues

7 months ago

Last Updated

0

Weekly Downloads

v1.0.3

npm Version

166.9 KB

Unpacked Size

4

Dependencies

GitHub stars

Trends appear after 7 days of data. Daily snapshots have not started yet.

npm weekly downloads

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

32/100Fair

Composite score based on GitHub activity, stars, npm downloads, publish recency, dependency count, and package size.

Badge for your README

Payload Directory health badge
Markdown
[![Payload Directory](https://payloaddirectory.dev/badge/732042021-root.svg)](https://payloaddirectory.dev/plugins/732042021-root)
HTML
<a href="https://payloaddirectory.dev/plugins/732042021-root"><img src="https://payloaddirectory.dev/badge/732042021-root.svg" alt="Payload Directory"></a>
Updated Feb 28, 2026Created Dec 15, 2023Published Oct 20, 2025

README

payload-exportcollections-plugin

Extends mzinga with the ability to export all collection's data to CSV or JSON

Install

npm install @newesissrl/payload-exportcollections-plugin

Get Started

mzinga.config.ts

import { exportCollectionsPlugin } from "@newesissrl/payload-exportcollections-plugin";

export default buildConfig({
    ....
    plugins: [exportCollectionsPlugin(config?)],
    i18n: {
      resources: {
        // to localize the buttons' labels
        en: {
          general: {
            "export-list-csv": "Export list (CSV)",
            "export-list-json": "Export list (JSON)",
          },
        },
        it: {
          general: {
            "export-list-csv": "Esporta lista (CSV)",
            "export-list-json": "Esporta lista (JSON)",
          },
        },
      },
    }
    ....
})

The plugin may expects a config object defined like this:

export type ExportCollectionsPluginConfig = {
  disabledCollections?: string[];
  rootDir?: string;
  jsonReplacer?: (key: string, value: any) => any;
  csvOptions?: Json2CsvOptions;
  componentPlacement?:
    | "AfterList"
    | "AfterListTable"
    | "BeforeList"
    | "BeforeListTable";
};

where:

  • disabledCollections is a list of collections' slugs that you want to exclude from the plugin's enrichment.
  • rootDir is the directory where to temporarily store the exported files
  • componentPlacement identify where to place the component
  • jsonReplacer is a function useful to replace fields (and/or omit them in the final result). see here
  • csvOptions is the same implementation as per the core json-2-csv package. see here

Notes

If you followed the above guide and still cannot see the buttons, it may be needed to update your webpack config as per below:

export default buildConfig({
  admin: {
    webpack: (config: any) => {
      return {
        ...config,
        resolve: {
          ...config.resolve,
          alias: {
            ...config.resolve.alias,
            payload: path.resolve("./node_modules/mzinga"), // this will fix the components usage of `useConfig` hook
          }
        }
      }
    }
  }
})

Similar plugins