A CSV export plugin for Strapi v5 that adds export functionality to the admin panel with configuration options.
npm install @fresh.codes/strapi-plugin-export-csv
- Go to any content type in the admin panel (e.g., Articles)
- Apply filters, search, or sort as needed
- Click the "Export CSV" button in the header
- The CSV will download with your filtered data
- Go to any content type list view
- Select specific records using checkboxes
- Click "Export CSV (X selected)" in the bulk actions menu
- Only selected records will be exported
Option | Type | Default | Description |
---|---|---|---|
excludedColumns |
string[] |
['password', 'resetPasswordToken', 'registrationToken'] |
Fields to exclude from export |
maxRecords |
number |
10000 |
Maximum records to export |
batchSize |
number |
100 |
Records per batch (memory management) |
useContentManagerLabels |
boolean |
true |
Use field labels from admin configuration |
debug |
boolean |
false |
Enable detailed debug logging |
fieldTransforms |
object |
{ updatedBy, createdBy } |
Functions to transform field values |
headerTransforms |
object |
{} |
Custom column header names |
csvOptions |
object |
CSV Stringify defaults | CSV formatting options |
populate |
string|array|object |
'*' |
Relations to populate |
contentTypes |
object |
{} |
Override any config for specific content types |
// config/plugins.js
module.exports = {
'export-csv': {
enabled: true,
config: {
// Global settings (apply to all content types)
batchSize: 50,
// Content-type specific overrides
contentTypes: {
'api::article.article': {
batchSize: 10,
excludedColumns: ['internalNotes'],
},
},
},
},
}
Field transforms allow you to modify values before they're written to CSV. The plugin includes several default transforms and supports custom ones.
The plugin automatically applies these transforms:
// These are applied by default - no configuration needed
fieldTransforms: {
updatedBy: (value) => value?.username ?? '',
createdBy: (value) => value?.username ?? ''
}
type FieldTransform = (
value: any, // The field value
record?: any, // The full record object (optional)
field?: string, // The field name (optional)
) => any // Return the transformed value
The plugin uses the csv-stringify library. All options are supported:
csvOptions: {
delimiter: ';', // Use semicolon instead of comma
header: true, // Include headers
quoted_string: true, // Quote string values
escape: '"', // Escape character
quote: '"', // Quote character
bom: true, // Add BOM for Excel compatibility
// Type-based formatting
cast: {
boolean: (value) => value ? 'Yes' : 'No'
}
}
Enable detailed logging for troubleshooting:
Add to config/server.ts
:
export default ({ env }) => ({
// ... other config
logger: {
config: {
level: 'debug', // Required to see debug logs
},
},
})
// config/plugins.js
module.exports = {
'export-csv': {
enabled: true,
config: {
debug: true, // Enable for all content types
// Or enable per content type
contentTypes: {
'api::article.article': {
debug: true, // Only debug article exports
},
},
},
},
}
Made by Fresh Codes.