Bulk-loading datasets into CKAN from spreadsheets with ckanapi

A spreadsheet inventory and file share can become a CKAN catalog through documented ckanapi calls and the DataStore. Most of the work is cleaning and mapping, so effort follows inventory quality more than row count.

On this page

Spreadsheet to CKAN migration: what the bulk load involves

Moving an inventory kept in a spreadsheet and files on a share into CKAN is mostly cleaning and mapping, followed by a scripted load. The effort tracks inventory quality, the number of organizations and the volume of files. Row count matters less, because one clean row with a very large file behind it can take more work to move than a messy row with no file. The one-time work has five parts: cleaning the inventory, making mapping decisions, writing the ckanapi script, running the load and getting sign-off from the data owners. Mapping decisions cause most of the delay. Each spreadsheet column needs a target, whether that is a dataset field, a resource field, an organization or a DataStore table. Settle early who owns each CKAN organization and who may edit it, because that decides how the script assigns datasets.

Sign-off is a one-time step, but it needs a named reviewer for each organization. Ask the data owners to confirm titles, descriptions, licenses and access levels in a staging instance before anything reaches the production portal. Plan the DataStore tables at the same time. Spreadsheet tables need consistent headers and column types, and you need a decision on which tables are queryable through the Data API and which stay as downloads. After sign-off, the script should key each record on a stable identifier, so that a later rerun updates existing datasets and does not create duplicates. Without that key, every addition from the share becomes a manual cleanup task.

After go-live, two kinds of recurring work remain. The first is reruns for new spreadsheet rows and files. Your team can run these itself if the script and mapping table are documented. The second is optional ongoing support, which DeployOpen offers as a retainer covering reruns, fixes and checks after CKAN upgrades. Retainer terms should be quoted separately from the one-time work. DeployOpen does not publish a price list. Most engagements are fixed-scope, so scope, deliverables and timelines are agreed in writing before work starts, and the quote follows from that written scope. When you ask for a quote, request the inventory assessment, the mapping table, the organization list and the sign-off steps as separate line items, and confirm which reruns are included.

Which spreadsheet columns map cleanly to CKAN and which do not

This table compares each spreadsheet element in your inventory with its CKAN target and notes what must be cleaned or decided before loading. Read the middle column for where the data lands and the last column for what to prepare first. The main takeaway is that rows, files, tags, licenses, visibility and sheets map directly, while formulas, comments, sharing and version history need decisions before the first ckanapi call.

Spreadsheet elementCKAN targetFit and migration note
Spreadsheet row per datasetOne CKAN packageClean fit. Give each row a stable unique name so reruns update the same package.
Folders and filesResources on the packageClean fit for files. CKAN has no folder tree, so keep folder paths in the resource name or description.
Owner or department columnOrganizationClean fit once values match existing organization slugs. Create missing organizations before package_create runs.
Tags, license and visibility columnsTags, license_id and private flagClean fit after splitting tags and matching licenses to identifiers. Confirm both license identifiers and the metadata schema first.
Tabular sheetsDataStore tableClean fit when each sheet is exported as CSV and loaded with XLoader. Confirm the loader is enabled on the target instance.
Formulas and merged cellsNo field, flatten to valuesNeeds preparation. Export computed values and unmerge cells before the file is loaded.
Cell commentsNo native fieldNeeds a decision. Move the text into notes or a log file, or drop it with a recorded reason.
Per-row sharingOrganization roles and collaboratorsNeeds a second pass. Users and memberships must exist before collaborators can be assigned.
Version history in file namesNo native fieldNeeds a decision. Keep versions as resource names, in a custom field, or load only the latest file.

When spreadsheet tables belong in the CKAN DataStore

Load a spreadsheet into the DataStore only when its contents are a table that people will query by row, column or keyword. The DataStore keeps structured data from resources in its own PostgreSQL database, separate from the main CKAN database. It uses two database roles: a write user that loading tools use to create and fill tables, and a read-only user that serves queries. The Data API on top of it adds filtering, full-text search, pagination and SQL queries, which is what makes a loaded table useful to someone who does not want to download the whole file. Before your scripts create resources, confirm with your CKAN administrator that the DataStore is enabled on the target site and that both database roles are configured.

For loading, use XLoader. It is the officially supported tool for loading uploaded or linked files into the DataStore, and DataPusher is now legacy, so a new pipeline should not be built on DataPusher. Confirm the file formats and size limits that XLoader accepts for your CKAN version before you plan the batch, because oversized or unusual files can fail to load and leave a resource without a queryable table. Then decide per file. A spreadsheet belongs in the DataStore when it has a stable header row, one header per column, and consistent column types from the first data row to the last. Inventories with notes above the header, merged cells, or a column that mixes dates and free text usually need cleaning first.

Keep any file that fails those checks as a plain resource. A plain resource stays downloadable from the dataset page and through the API without the DataStore, so a scanned PDF, a multi-sheet workbook or a layout that a person must read still gets published and found. Record the decision in your inventory with a column that marks each file as DataStore or download only, so the ckanapi script applies the right step and the team can review exceptions later. After each batch, check that DataStore-backed resources return rows through the Data API and that download-only resources still open. Log every failed load with its error, so you can fix the source file or reclassify it before the next run.

ckanapi and the CKAN API: the documented paths for a bulk load

A scripted load uses five documented paths: the ckanapi client, action API calls, XLoader, DataStore API actions and ckanext-dcat. Each one covers a different part of the work, from creating records to making tables queryable and reading DCAT metadata. Confirm the version of each component against the CKAN version your portal runs before you script anything.

ckanapi client version

The ckanapi Python package and command line client wrap the CKAN action API, so your load script calls the same endpoints the portal exposes. Match the ckanapi release to the CKAN version in use (2.10, 2.11 or 2.12), and pin it in the script's environment so a reinstall does not change behavior. Before the first write, confirm the remote URL and API token with a read-only call. Also confirm the portal's CKAN version, because minor releases may include backwards-incompatible changes.

CKAN release policy

Action API record calls

Four actions carry most of the record work: organization_list reads existing organizations, organization_create adds any that are missing, package_create creates each dataset, and resource_create attaches each file or link. Build the organization map from organization_list output first, so every row resolves to an organization name confirmed on the portal. Confirm that the API token's user holds the right role in each organization. Also decide in advance how the script handles duplicate dataset names on a re-run, because package_create will not silently merge them.

XLoader table loading

XLoader is the officially supported tool for loading uploaded or linked files into the CKAN DataStore, and DataPusher is now legacy. Use it for resources that are tabular files, such as the CSV exports from your cleaned inventory, so each table becomes queryable through the Data API. Confirm that each load job finishes, because a resource can upload successfully and still have no DataStore table. Also confirm that the XLoader service is running on the target portal, that it accepts the resource format, and what file size limit the operator has set.

DataStore docs

DataStore API table work

DataStore API actions handle table-level work after a load, such as checking row counts and sample values with datastore_search, or correcting individual rows with datastore_upsert instead of re-uploading the whole file. The DataStore keeps a write user and a read-only user, so decide which credentials your script uses for writes and confirm that readers only get the read-only path. Check the exact action names and parameters for your CKAN version in the API documentation before you script verification around them.

ckanext-dcat for DCAT metadata

Use ckanext-dcat only when the inventory already carries DCAT metadata that should map to CKAN fields, such as DCAT-AP values exported from another catalog. The extension provides DCAT-AP v1, v2 and v3 schemas, DCAT RDF endpoints and an RDF harvester, which is a separate path from a spreadsheet load. The extension is supported on CKAN 2.10 and 2.11, so confirm support for CKAN 2.12 before relying on it. Also check which DCAT-AP version your inventory uses.

ckanext-dcat repository

How a spreadsheet row becomes a CKAN dataset and a DataStore table

The flow starts with the inventory and file share, where rows and files pass through cleaning and validation. The mapping file then records the organization, licence, tag and schema decisions for each row. A ckanapi script runs inside the CKAN administration boundary, using an API token to call package_create and upload resources. CKAN stores the organizations, datasets and files, and XLoader jobs load tabular files into the DataStore using a write user. The Data API reads through a separate read-only user. Check the token's scope, confirm the write and read users have separate permissions, and confirm that XLoader finished for every tabular resource.

Spreadsheet rows move through validation and a mapping file into CKAN and the DataStore.

Spreadsheet to CKAN migration in five phases with a parallel run

Each phase ends with a check that the next phase depends on, so the spreadsheet stays the source of truth until the CKAN catalog has matched it through repeated loads. The sequence moves from a cleaned inventory to a pilot, a full scripted load into staging, a parallel run, and a controlled cutover. The output is a CKAN catalog that matches the inventory and file share, with old links redirected and the old listing retired.

  1. Inventory and clean the spreadsheet

    The inventory owner reviews every row before any code runs. Remove duplicate rows by comparing titles, source URLs and file hashes, not only names, so near-copies are caught. Confirm that each dataset has a named owner and a target organization, check that every file path in the share resolves to a file, and normalize license values and date formats so the loader sees one consistent shape. Assign a stable identifier to each row, since the loader will derive CKAN package names from it. Done means the cleaned sheet has an identifier for every row and an exception list where every open item has an owner.

  2. Decide mappings and pilot one organization

    The engineering team and the data owners agree on how each spreadsheet column maps to a CKAN dataset field, a resource, or a custom extra, and which organization each dataset belongs to. Record these decisions in a mapping document, including how package names are built from the stable identifiers, because changing those names later creates new packages. Run the loader against one organization in a staging CKAN using a copy of the file share. Reviewers check the results in the browser and through the API. Done means the pilot datasets, resources and any DataStore tables look correct to the data owners, and the mapping document is approved.

  3. Run the full scripted load

    With the pilot approved, run the full loader against staging using ckanapi. The script calls package_create for new datasets and package_update for datasets that already exist, uploads each resource file, and sends tabular resources to the DataStore. Because package names come from the stable identifiers, a rerun after a failure or a correction updates existing packages and does not create duplicates. The loader writes a run log that records each dataset, resource and error. Done means the log shows no unresolved errors, and a second run over the same input creates no new packages.

  4. Run the parallel comparison against the sheet

    Operate the staging catalog alongside the spreadsheet for as long as the data owners need to build confidence. The spreadsheet stays authoritative, so owners keep editing it and the loader reruns to pick up changes. Reviewers compare dataset counts, titles, resources and DataStore row counts against the sheet. They also check each resource's size and checksum against the source file, which confirms the uploaded file is complete and unchanged. Discrepancies go back to the mapping or cleaning step, the fix goes into the loader, and the run repeats. Done means every count, title, row count and checksum matches.

  5. Cut over with a final run and redirects

    Announce a freeze on changes to the source spreadsheet and the file share, then run the loader one last time against production CKAN. Repeat the count, title, resource and row checks, and confirm size and checksum for every file before anything is switched. Add redirects from old listing links to the matching CKAN dataset pages, and test a sample of old links to confirm they resolve. Retire the old listing only after the redirects work and the owners confirm the catalog. Done means the old links resolve, the spreadsheet is archived as read-only, and the old listing is decommissioned.

What drives the cost and duration of a spreadsheet load

This table compares the factors that change how much work a spreadsheet load takes and how long it runs, with one row per driver. Read the second column to see what adds effort and the third column to see what keeps the load small. Most drivers are one-time costs, but access setup and script re-runs recur whenever the inventory changes.

DriverWhat raises effortWhat lowers effortOne-time or recurring
Inventory qualityMissing owners, inconsistent names and duplicate rows that need manual decisionsOwners, names and duplicates resolved in the spreadsheet before any script runsOne-time, repeated for each new inventory
Organizations and mappingMany organizations and file groups with unclear ownershipA short mapping table of files to organizations, signed off before the first runOne-time
Files on the shareMany files, large files, nested folders and mixed formatsFiles grouped by dataset, sizes checked early and uploads run in batchesOne-time per load, repeated on each refresh
Tabular files for the DataStoreMany CSV or Excel files that need row-level queries and loader runsOnly datasets that need row queries are loaded, with consistent headersOne-time per table, plus loader reruns
Metadata beyond the default schemaCustom fields, multilingual values and DCAT mapping added to every recordDefault fields first, with extra fields added to the schema in a later phaseOne-time for the schema, recurring as records are added
Access modelPrivate datasets, organization roles, collaborators and SAML2 attribute mapping through ckanext-saml2auth if SSO is in scopePublic datasets first, roles assigned by the portal team and SSO scheduled separatelyOne-time setup, recurring for user changes
New or live instanceA live portal with existing datasets, users and duplicates to reconcileA new instance with an empty catalog and no legacy records to mergeOne-time
Testing and sign-off scopeFull row checks, permission tests and written sign-off from each data ownerSample-based checks against a written acceptance list agreed up frontOne-time, with retests after each script change

What goes wrong in a spreadsheet to CKAN migration and how to prevent it

Most failed spreadsheet loads trace back to a few decisions made before the first script runs. The six cards below cover identifiers, visibility, organizations, DataStore loading, links and credentials. Each one names the failure, the early sign to watch for and the step that prevents it.

Duplicate datasets on rerun

A script that calls package_create for every row creates a second dataset each time it runs after a partial failure or a corrected spreadsheet. The early sign is two datasets with near-identical titles and different names, often in the same organization. Give every row a stable identifier, such as the source system ID, and store it in the dataset name or a custom extra. Build an update path with package_show and package_update so reruns change existing records instead of adding new ones. Test a rerun on a staging copy before the production load.

Restricted files published by mistake

Spreadsheets and file shares often hold files that were never meant for a public portal, and a bulk load can publish them in one pass. The early sign is a dataset visible in anonymous search before the data owner has signed off. Check the permissions on each source file share and mark any restricted dataset as private until approved in the load sheet. Confirm the default visibility for new datasets on the staging instance, then have each owner review the list of public datasets before the production load.

Organizations created ad hoc

If the loader creates an organization whenever a spreadsheet names one, the catalog gains departments, abbreviations and typos as separate owners. The early sign is an organization list that grows with each load and contains near-duplicate names. Agree on a mapping from spreadsheet owner values to CKAN organizations with the data owners before any script runs. Have the script look up each organization with organization_show and stop on any value missing from the approved list. Create new organizations only through a reviewed change.

Tabular files failing in XLoader

XLoader loads uploaded or linked files into the DataStore, and files that open cleanly in a spreadsheet can still fail there. Common causes are byte order marks or non-UTF-8 encodings, header rows that do not sit on the first line, and columns that mix numbers and text. The early sign is a resource with no DataStore view or a loader status that stays in error after upload. Test large and unusual files in staging first, and compare the DataStore row count with the source file.

DataStore docs

Broken links and old share references

Old share paths in reports, emails, web pages and other portals keep pointing at files that moved or were renamed during the load. The early sign is a rise in 404 responses or support requests for old paths in the weeks after cut-over. List every inbound link you can find in web logs, the share index and owners' documents. Map each old path to its new dataset or resource URL, set redirects before the cut-over date, and keep the map with the load script so later loads reuse it.

API tokens left in scripts

The ckanapi script needs an API token with write rights, and that token often ends up hard-coded in a script or committed to a repository. The early sign is a token string found in a commit history, a shared script or a chat thread. Create the token for a dedicated account that holds only the organization roles the load requires. Read the token from an environment variable or a secrets store at run time, keep it out of source control, and rotate it after the load.

Spreadsheet to CKAN migration: questions buyers ask before hiring help

What does a spreadsheet to CKAN migration quote include, and who pays for what?

The partner's fixed-scope written quote covers the agreed build work, and your organization pays for three separate things. First, your staff time: data owners confirm organizations and licences, and someone with CKAN administration access signs off, so budget that time internally. Second, the partner's fee, set by a written quote that lists the cleaning, scripting, organization setup, resource uploads, DataStore loads and handover. Third, CKAN hosting in your own cloud, data center or air-gapped network, which is a separate line paid to whoever runs that infrastructure. Ask each quote to show these three lines separately, along with any exclusions such as theming or extension work. DeployOpen does not publish a price list, so the quote follows from the written scope.

Which costs are one-time and which recur after the bulk load?

The bulk load itself is one-time work: cleaning the inventory, writing and testing the scripts, creating organizations, loading resources and tables, and handing over. Recurring costs start at go-live. CKAN hosting in your infrastructure runs every month whether or not the catalog changes, and you will also carry patch releases, search index maintenance, backups and monitoring of background jobs. Publishing new datasets later by your own staff is an ongoing effort, too. Optional retainers for ongoing support, upgrades and continuous testing are priced separately from the migration. If you plan scheduled loads from the file share, treat them as a new scope item with its own quote. Ask the partner to list every recurring item and who owns it after handover, so the run cost is clear before you sign.

How long does a spreadsheet to CKAN migration take to complete?

The duration depends on a few drivers, so ask for a timeline built from your inventory rather than a generic estimate. The largest driver is inventory quality: the number of rows, how many lack titles or stable identifiers, how many licence values need correction, and how many organizations must be created or mapped. The file share matters next. The number of files, their sizes, whether they are uploaded or linked, and whether tables need DataStore loads all change the work. Owner availability also sets the pace, because each open licence or organization question waits on a person. Finally, the number of staging rounds before sign-off adds time. The written scope should state milestones and assumptions, so ask what would move each milestone.

What does our team need to provide during the migration work?

Your team provides four things. Data owners confirm which organization each dataset belongs to, the licence and any access restrictions, and whether each row or file should be published at all. Someone with access to the file share provides read access and a copy or snapshot of the inventory, plus a named contact for questions about file paths. You provide a staging CKAN instance that matches the target version and stays separate from production, so loads can be rehearsed and checked. A named sign-off owner reviews the staging catalog against agreed checks and approves the production run. Before work starts, confirm in writing who holds each role, how quickly reviewers respond, and how questions are routed, since slow owner answers often hold up a load.

Can our own team run a CKAN spreadsheet migration without a partner?

Yes, if your team has the right skills and a clean inventory. The work uses documented tools: ckanapi, a Python client library and command line tool for the CKAN API, and the DataStore for tabular data. You need someone comfortable writing and debugging Python scripts, someone who administers CKAN (organizations, API tokens and sysadmin accounts), and time for a staging run before production. A clean inventory has one row per dataset, stable identifiers, agreed organization names and valid licence values. If those conditions are missing, cleaning and owner decisions will take most of the effort, and that is the part a partner can scope in writing. Start with a pilot of a few datasets, record each error, and confirm every step in your own environment before the full run.

Which CKAN version should we target for a spreadsheet migration?

Target CKAN 2.12.0 for a new portal, and confirm the latest patch before you install. CKAN 2.12.0 was released on August 26, 2026, together with maintenance releases 2.11.6 and 2.10.11 on the same day. Under the CKAN release policy, the tech team supports the latest patch of the current minor version and the previous minor version, so 2.11 is the previous minor line and still receives security and bug fixes. Targeting 2.11 is reasonable if an extension you need is not yet confirmed for 2.12. Check every extension first: ckanext-dcat, for example, is supported on CKAN 2.10 and 2.11, so confirm its status on 2.12 before you pin it. Minor releases may include backwards-incompatible changes, so pin the version and read the release notes before any upgrade.

Can the bulk load run twice without creating duplicate datasets?

A rerun is safe only if the script is written for it, so design for reruns before the first load. Each dataset needs a stable identifier taken from the inventory. The script should look up an existing package by that name before calling package_create, then skip it or update it with package_update. Resource uploads need the same check, because re-uploading a file can leave two resources with the same name. Create each organization once and reuse it on every run. Test the rerun on staging by running the script twice on the same input and comparing dataset counts, resource counts and DataStore row counts. Confirm how your ckanapi version and CKAN configuration handle existing records in your own environment, because the outcome depends on the script's logic.

How DeployOpen scopes and delivers a spreadsheet to CKAN migration

DeployOpen plans the spreadsheet to CKAN load as a data project with a written scope. We start from your inventory and file share, build the ckanapi loader and DataStore steps in your own infrastructure, and hand over scripts your team can review and rerun. Engagements are fixed-scope, and ongoing support is available as a retainer.

How we scope

  • The written scope lists the inventory fields, organizations, and file share paths that the load will cover.
  • Cleaning rules for titles, licenses, tags and duplicate rows are agreed before any script runs.
  • We confirm which tables go to the DataStore and which files stay as plain downloads.

How we build

  • A ckanapi script creates each package with package_create, then attaches resources from the file share.
  • Organization assignment comes from a mapping table that your team reviews before the first run.
  • Tabular resources load into the DataStore through XLoader, the officially supported loader for CKAN.

How we hand over

  • Scripts, the mapping table and a run log are delivered in a repository your team controls.
  • A runbook explains how to rerun the load, roll back a batch and add new spreadsheets later.
  • Your team receives a verification report with record counts, failed rows and DataStore row totals.

How we support

  • Support covers reruns after spreadsheet changes, failed batches and questions about the loader code.
  • Ongoing support, upgrades and continuous testing are available as a retainer after handover.
  • If CKAN is upgraded later, we can retest the loader against the new version before it runs again.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.