Simplified CSV importer for collections with dynamic property columns.
New CSV Format (Simplified)
Instead of complex field naming (collection_field_1_name, collection_field_1_label, etc.), this version uses property names directly as column headers.
Basic Columns (Required)
- title (required)
- description (required)
- status (required)
- access_level (required)
- creator_id (required)
- unit_id (required for auto-generating codes)
Auto-Generated Codes
- collection_code - Auto-generated if left empty (requires unit_id)
- item_N_item_code - Auto-generated if left empty (requires unit_id, type_id)
- item_N_inventory_code - Auto-generated if left empty (requires unit_id, type_id)
Optional Columns
- thumbnail
- collection_type
- sort_order
- parent_id
- type_id (recommended for better code generation)
- template_id
Dynamic Property Columns
Any column that matches a property's local_name will be automatically added as a collection field. For example:
- author → Creates collection field with name="author"
- subject → Creates collection field with name="subject"
- publisher → Creates collection field with name="publisher"
- isbn → Creates collection field with name="isbn"
Item Columns (up to 50 items)
- item_N_item_code
- item_N_inventory_code
- item_N_location
- item_N_status
- item_N_condition
- item_N_availability
- item_N_price
- item_N_acquisition_date
- item_N_rfid_tag
- item_N_unit_id
- item_N_item_location_id
Example CSV (with codes auto-generated)
title,description,status,access_level,creator_id,unit_id,type_id,author,subject,publisher,item_1_location
Elixir Book,A guide,published,public,1,1,2,José Valim,Programming,Pragmatic,Section AThis creates:
- 1 collection (with auto-generated collection_code)
- 3 collection fields (author, subject, publisher)
- 1 item (with auto-generated item_code and inventory_code)
Example CSV (with explicit codes)
collection_code,title,description,status,access_level,creator_id,unit_id,author,subject,publisher,item_1_item_code,item_1_inventory_code,item_1_location
COL001,Elixir Book,A guide,published,public,1,1,José Valim,Programming,Pragmatic,ITEM001,INV001,Section AThis creates:
- 1 collection (with specified collection_code)
- 3 collection fields (author, subject, publisher)
- 1 item (with specified codes)
Summary
Functions
Generate a simplified template based on available properties.
Import collections from uploaded CSV content.
Get available properties for template generation.
Functions
Generate a simplified template based on available properties.
Import collections from uploaded CSV content.
Options
:skip_errors- Continue importing even if some rows fail (default: false):batch_size- Number of records to process at once (default: 100):dry_run- Validate without saving to database (default: false):current_user- Current user performing the import (for logging)
Get available properties for template generation.