Import and export (module)
Import and export is an official module: an admin installs it and switches it on under Modules (Managing modules). Then every collection's list has Import and export, which opens a page with two parts:
- Import: a CSV or JSON file becomes new drafts, or new draft versions of entries that are already there. Nothing is published or deleted. The file is checked first, row by row, and nothing is saved until you press Import.
- Export: the collection's entries as a CSV file, in the same form the import reads, so you can change it in a spreadsheet and import it again.
This is not the export or import of a whole instance, which stays in SHADE itself (Exporting, Updates and backups).
What users can do
Editors and admins, with create or edit on the collection:
- Open the collection's list and click Import and export. Under Import, choose a
.csvor.jsonfile and, when the site has more than one language, the language of its rows. - Click Check the file. The table says for each row what it would do: New draft, Update (with a link to the entry it updates), or Error with each field that is wrong and why. Columns that are not imported are named above it. Nothing is saved yet.
- Click Import. A file with errors can only be imported with Skip the rows with errors ticked; those rows are then left out.
- Follow the import on its result screen: how many rows are done, how many new drafts, updates, unchanged, skipped and
failed rows. Download these rows as CSV gives the rows that were not imported, with a last column
errors: correct them and import that file again. - Under Export, choose the language (when the site has more than one) and click Download CSV.
AI users (MCP) have no import or export.
Who may do it
| What | Permission | Who has it by default |
|---|---|---|
| Import new entries (rows that create) | collections.<slug>.read and collections.<slug>.create | admin, editor |
| Import changes to entries (rows that update) | collections.<slug>.read and collections.<slug>.update | admin, editor |
| Export the entries as CSV | collections.<slug>.read | admin, editor |
Each row is checked on its own: with create but not edit, rows that would update an entry are errors, and the other way round. The import saves every row as the team member who started it, with their role as it is when the row is saved: the history shows them as the author, and the audit log has each save. A custom role's field rules hold too: a column for a field the role hides is an error, and one the role may only read must keep the value it has. A role limited to its own entries (or its groups' and its own) may only update those: a row for another entry is an error, with the same message as in the editor.
The result screen and its CSV are only for the team member who started the import, and for admins. They are deleted 30
days after the import ended (Data retention, kind import.imports, under the module).
The file
CSV has a header row with the field names, as title,slug,date. It is read the way SHADE writes its own CSV
files: UTF-8 (with or without a byte order mark), commas between cells, quotes around a cell with a comma, a quote or
a line break in it (a quote inside written twice: "say ""hi"""), and Windows or Unix line ends. A value SHADE wrote
with a ' in front, because a spreadsheet would take it for a formula, is read without it.
JSON is an array of objects, one per entry, each with the field names as keys: [{ "title": "Fietsen", "slug": "fietsen" }]. Values are as the API takes them.
| Field | In a CSV cell | In JSON |
|---|---|---|
| Text, long text, email, address, slug, choice | as written | as written |
| Number | 12.5 (a dot for decimals) | a number |
| Money | euros, 12.50 | cents, 1250 |
| Switch | true/false, yes/no, ja/nee, 1/0 | true or false |
| Date | 2026-11-14, or a date and time as 2026-11-14T09:30:00+01:00 | the same |
| Image or file | the file's id, or its name in the media library | the same, or { "mediaId": "…" } |
| Relation to one entry | its id, or its slug | the same |
| Groups, lists, several relations, several emails, rich text, links | not in CSV | as the API takes them |
An empty cell is no value. A column that names no field, or in CSV a field of the table's last row, is not imported: the check names it.
Limits: a file is at most 5 MB and 5,000 rows.
Which entry a row changes
- A row with an
idcolumn updates that entry. An id that is no entry, or an entry in the trash, is an error. - Otherwise a row whose slug matches an entry's slug updates that entry, and the slug stays as it is.
- Otherwise the row is a new draft.
An update keeps everything the row leaves out, and becomes the entry's newest draft version (with the note "Imported"). A published entry stays published as it was: its update waits as unpublished changes. A row that changes nothing saves nothing and counts as unchanged.
Languages
The language of a row is its locale cell, else the language chosen for the file, else the default language. A row in
another language is that language's text of an entry that is already there: it must have an id or a slug that finds
it (its slug in that language, or in the default language), and it may only fill fields with text per language.
Rules and checks
- Checked as a save. The check runs every row through the same checks as saving it in the editor: the field types, the collection's own rules, the modules' checks, what relations and images point to, and unique values. A slug that an entry in the trash keeps is an error ("A post in the trash already uses this slug"), as is a slug twice in the file.
- Usage limits. New entries count toward the instance's entries limit: the rows past it are errors.
- Not everywhere. A collection with a single entry (such as a menu) and a collection without drafts (where every save is live at once) have no import.
- In the background. The module's job on the worker saves the rows, 100 at a time. A row that fails then (because something changed since the check) is recorded with why, and the rest goes on. If the team member who started it is deactivated, the import stops.
- Audit. Starting an import is in the audit log (
import.start), and every row it saves as a create or a save.
The export
The CSV has a column id and a column locale, then a column for each field one cell can hold, in the collection's
order; groups, lists, several relations, rich text and links are left out (export them through the
content API instead). Each entry is its newest saved version, the draft if it has one.
Values are written the way the import reads them: money in euros (12.50), switches as true or false, an image,
file or related entry by its id. A field your role hides is left out. In another language than the default, the file
has only the fields with text per language, in that language's text; the import then reads it back as that language.
Import the file again and every row updates the entry its id names; rows you didn't change count as unchanged.
For developers
- The module's API, for a signed-in team member (never a token):
POST /api/packages/import/check(the check) andPOST /api/packages/import/imports(start), both JSON withcollection,name,text(the file as text),localeand, to start,skipErrors;GET /api/packages/import/imports/:id(the result) andGET …/imports/:id/problems.csv;GET /api/packages/import/export.csv?collection=<slug>&locale=<code>. - The code and its tests: the module's
README.mdin theshade-plugin-importrepository. The decision: 0008 point 15; it saves as the member who started it through 0010 point 11.