Skip to content

Import CSV or Excel records

Enable the table import wizard for end users. The following complete module definition and index layout expose a small contacts table with import enabled. Syntax is verified against BakeryResourceModule and the SPA ResourceTableComponent; the wizard scenario has not been executed here.

Copy the Bakery definitions into the system directory, inspect php bakery plan <system>, then apply them in a disposable preview with php bakery apply <system>. A client must already exist.

modules/import_contacts/import_contacts.module.bake.json:

[
{
"resource_module": "import_contacts",
"resource": {
"identifier": "import_contacts",
"title": "name",
"fields": [
{
"identifier": "name",
"type": "text"
},
{
"identifier": "email",
"type": "email"
}
],
"importable": true,
"layouts": {
"index": "/modules/import_contacts/import_contacts.index"
}
}
}
]

modules/import_contacts/import_contacts.index.json:

{
"tabs": [
{
"identifier": "general",
"rows": [
{
"cols": [
{
"span": 24,
"components": [
{
"type": "resource_table",
"options": {
"module": "import_contacts"
}
}
]
}
]
}
]
}
]
}

Open /import_contacts in the preview and choose Import from the table toolbar. Upload a CSV/Excel file, map its columns and review the options. Do not disable toolbar.import. The module-header shortcut is not the supported UI entry. Field-level options.importable can exclude individual fields. Imports require the actor’s appropriate access rights; enabling the wizard grants no permissions.

Import a two-row file with name,email headers; confirm both records and test invalid email handling. Check duplicate handling with your chosen import options. The built-in wizard is not covered by a workflow trigger. For a custom import workflow, assert resulting values and counts; a verified file-fixture setup for that scenario is still missing.

  • Recommended for repeatable formats with business logic: file → action/import → per-row source/new/op/set/action/save. Types include csv/xls/xlsx; configure delimiter, encoding, offset and hasHeaderRow. Complete file-fixture tests remain unverified.
  • Recommended for assisted extraction from unstructured text/images: ai/entityFromText/ai/entityFromImage, followed by review. Only element availability was audited; the complete extraction pattern is unverified. Not recommended as a deterministic spreadsheet import.
  • Not recommended for setting imported values: relying on ordinary beforeSave mutations. Use defaults, field recipes or explicit saved follow-up logic.

Module schema · Import fields · Import action · Workflow tests · Assertions