Data Management
CSV Import / Export
Import and export collection data in CSV format — compatible with Excel, Google Sheets, and data migration workflows.
CSV Import / Export
FastCMS allows you to easily import and export data from collections in CSV format. This is useful for data migration, backups, bulk editing, and integration with spreadsheet applications like Excel or Google Sheets.
Via Admin Dashboard
Exporting Records to CSV
- Navigate to any collection's records page (e.g.,
/admin/collections/products/records) - Click the Export CSV button at the top of the page
- Your browser will download a CSV file named
{collection_name}_export.csv
The exported CSV includes:
- System fields:
id,created,updated - All custom fields defined in the collection schema
Importing Records from CSV
- Navigate to the collection's records page
- Click the Import CSV button
- Select your CSV file in the modal dialog
- Optionally check Skip validation to import all data as text without type checking
- Click Import
Important Notes:
- The first row must contain field names matching your collection schema
- System fields (
id,created,updated) will be ignored if present - Empty values are skipped
- Invalid data types will cause errors (unless "Skip validation" is checked)
Via API
Export Records to CSV
curl -X GET "http://localhost:8000/api/v1/collections/products/records/export/csv" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-o products_export.csvWith Filters and Sorting:
curl -X GET "http://localhost:8000/api/v1/collections/products/records/export/csv?filter=active=true&sort=-price" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-o active_products.csvQuery Parameters:
| Parameter | Description |
|---|---|
filter | Filter expression (e.g., price>=100&&active=true) |
sort | Sort field (prefix with - for descending) |
Export Limit: Maximum 10,000 records per export.
Import Records from CSV
curl -X POST "http://localhost:8000/api/v1/collections/products/records/import/csv" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-F "file=@products.csv"Response:
{
"imported": 95,
"total": 100,
"errors": [
{
"row": 23,
"error": "Row 23, field 'price': Cannot convert 'invalid' to number"
}
]
}With Skip Validation:
curl -X POST "http://localhost:8000/api/v1/collections/products/records/import/csv?skip_validation=true" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-F "file=@products.csv"CSV Format
Simple Example
name,price,active
Laptop,999.99,true
Mouse,29.99,true
Keyboard,79.99,falseField Type Formatting
| Field Type | Format |
|---|---|
| Dates | ISO 8601: 2025-01-15T10:00:00 |
| Booleans | true/false, 1/0, yes/no |
| Multi-select arrays | JSON: ["electronics", "sale"] |
| Text with commas | Wrap in double quotes |
Example with multiple field types:
title,quantity,published,publish_date,tags
"First Product",100,true,2025-01-15T10:00:00,"[""electronics"", ""sale""]"
"Second Product",50,false,2025-02-01T14:30:00,"[""clothing""]"Data Migration Workflow
Export from one collection, import into another:
# Step 1: Export source collection
curl -X GET "http://localhost:8000/api/v1/collections/old_products/records/export/csv" \
-H "Authorization: Bearer YOUR_TOKEN" \
-o products_backup.csv
# Step 2: Import to target collection
curl -X POST "http://localhost:8000/api/v1/collections/new_products/records/import/csv" \
-H "Authorization: Bearer YOUR_TOKEN" \
-F "file=@products_backup.csv"Handling Large Datasets
For collections with more than 10,000 records, export in batches using filters:
# Export with sort to enable cursor-based pagination
curl "http://localhost:8000/api/v1/collections/products/records/export/csv?filter=id>0&sort=id"For import, split your CSV into files of 5,000 records each and import sequentially.
Troubleshooting
| Problem | Solution |
|---|---|
| "Invalid CSV format" | Ensure first row contains field names |
| Partial success | Check errors array for specific row errors |
| Boolean not working | Use accepted formats: true/false, 1/0, yes/no |
| Dates import as text | Use ISO 8601 format: 2025-01-15T10:00:00 |
| Special characters | Ensure UTF-8 encoding, wrap in double quotes |
Access Control
| Operation | Required Permission |
|---|---|
| Export | list_rule on the collection |
| Import | create_rule on the collection |