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 collection data as CSV or JSON. It is registered as a plugin in the config and built for the mzinga fork of Payload, with mzinga, react and react-i18next as peer dependencies. Options cover disabled collections, a temporary export directory, button placement, a JSON replacer and CSV options.

Features

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

Use cases

  • Download collection data as CSV for spreadsheet analysis
  • Export documents 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

41

Stars

3

Forks

5

Open Issues

Today

Last Updated

402

Weekly Downloads

v1.1.0

npm Version

167.3 KB

Unpacked Size

3

Dependencies

GitHub stars

41+1 since Sep 6

Show data
GitHub stars by day (UTC)
DateStars
Dec 5, 202641
Dec 4, 202641
Dec 3, 202641
Dec 2, 202641
Dec 1, 202641
Nov 30, 202641
Nov 29, 202641
Nov 28, 202641
Nov 27, 202641
Nov 26, 202641
Nov 25, 202641
Nov 24, 202641
Nov 23, 202641
Nov 22, 202641
Nov 21, 202641
Nov 20, 202641
Nov 19, 202641
Nov 18, 202641
Nov 17, 202641
Nov 16, 202641
Nov 15, 202641
Nov 14, 202641
Nov 13, 202641
Nov 12, 202641
Nov 11, 202641
Nov 10, 202641
Nov 9, 202641
Nov 8, 202641
Nov 7, 202641
Nov 6, 202641
Nov 5, 202641
Nov 4, 202641
Nov 3, 202640
Nov 2, 202640
Nov 1, 202640
Oct 31, 202640
Oct 30, 202640
Oct 29, 202640
Oct 28, 202640
Oct 27, 202640
Oct 26, 202640
Oct 25, 202640
Oct 24, 202640
Oct 23, 202640
Oct 22, 202640
Oct 21, 202640
Oct 20, 202640
Oct 19, 202640
Oct 18, 202640
Oct 17, 202640
Oct 16, 202640
Oct 15, 202640
Oct 14, 202640
Oct 13, 202640
Oct 12, 202640
Oct 11, 202640
Oct 10, 202640
Oct 9, 202640
Oct 8, 202640
Oct 7, 202640
Oct 6, 202640
Oct 5, 202640
Oct 4, 202640
Oct 3, 202640
Oct 2, 202640
Oct 1, 202640
Sep 30, 202640
Sep 29, 202640
Sep 28, 202640
Sep 27, 202640
Sep 26, 202640
Sep 25, 202640
Sep 24, 202640
Sep 23, 202640
Sep 22, 202640
Sep 21, 202640
Sep 20, 202640
Sep 19, 202640
Sep 18, 202640
Sep 17, 202640
Sep 16, 202640
Sep 15, 202640
Sep 14, 202640
Sep 13, 202640
Sep 12, 202640
Sep 11, 202640
Sep 10, 202640
Sep 9, 202640
Sep 8, 202640
Sep 7, 202640
Sep 6, 202640
npm weekly downloads

142+87 since Sep 6

Show data
npm weekly downloads by day (UTC)
DateWeekly downloads
Dec 5, 2026142
Dec 4, 2026142
Dec 3, 2026110
Dec 2, 202682
Dec 1, 202682
Nov 30, 202681
Nov 29, 202652
Nov 28, 202655
Nov 27, 202655
Nov 26, 202656
Nov 25, 202646
Nov 24, 202647
Nov 23, 202647
Nov 22, 202618
Nov 21, 202617
Nov 20, 202621
Nov 19, 202623
Nov 18, 202687
Nov 17, 202685
Nov 16, 202685
Nov 15, 202682
Nov 14, 202683
Nov 13, 202683
Nov 12, 202681
Nov 11, 202620
Nov 10, 202654
Nov 9, 202655
Nov 8, 202668
Nov 7, 202666
Nov 6, 202663
Nov 5, 202665
Nov 4, 202667
Nov 3, 202632
Nov 2, 202631
Nov 1, 202619
Oct 31, 202617
Oct 30, 202617
Oct 29, 202613
Oct 28, 20268
Oct 27, 20269
Oct 26, 202610
Oct 25, 20268
Oct 24, 20268
Oct 23, 20266
Oct 22, 202614
Oct 21, 202633
Oct 20, 202635
Oct 19, 202634
Oct 18, 202638
Oct 17, 202639
Oct 16, 202645
Oct 15, 202643
Oct 14, 202667
Oct 13, 202665
Oct 12, 202668
Oct 11, 202667
Oct 10, 202667
Oct 9, 202673
Oct 8, 202682
Oct 7, 202642
Oct 6, 202642
Oct 5, 202640
Oct 4, 202642
Oct 3, 202647
Oct 2, 202643
Oct 1, 202634
Sep 30, 202639
Sep 29, 202638
Sep 28, 202638
Sep 27, 202639
Sep 26, 202637
Sep 25, 202636
Sep 24, 202633
Sep 23, 202628
Sep 22, 202629
Sep 21, 202662
Sep 20, 202663
Sep 19, 202660
Sep 18, 202664
Sep 17, 202664
Sep 16, 202668
Sep 15, 202670
Sep 14, 202638
Sep 13, 202638
Sep 12, 202649
Sep 11, 202649
Sep 10, 202656
Sep 9, 202655
Sep 8, 202656
Sep 7, 202656
Sep 6, 202655

Each point is npm's rolling 7-day download count.

Health Score

78/100Excellent

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 Dec 5, 2026Created Dec 15, 2023Published Dec 3, 2026

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

mzinga (^1.0.5), react and react-i18next are peer dependencies: the plugin uses the copies installed by the host application, so only one Mzinga instance is loaded.

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