Migrating Bubble CSV Imports: Keep Customer Uploads Reliable
A customer uploads a spreadsheet, sees a timeout, and tries again. Did the first import fail, finish, or stop halfway through? If the replacement app cannot answer that question, a Bubble-to-code migration can turn a routine upload into duplicate customers, missing orders, or hours of cleanup.
Treat recurring CSV imports as a product feature, not just a file parser. The migration needs to preserve what each row means, which records it can change, how errors are reported, and what happens after a retry.
This guide covers imports that customers or staff run during normal operations. Moving the existing database once is a different job; use the Bubble data migration checklist for that launch-stage work.
Start with the import your users actually have
Bubble distinguishes its editor's CSV importer from the in-app Upload data as CSV action. The latter adds items to the application database and maps columns to fields of the chosen type. A plugin or a custom workflow may add mapping screens, updates, validation, or background processing around that action.
Inventory the actual path before rebuilding it. Who uploads the file? Which template do they use? Does the import create new records, update existing ones, or do both? Does it trigger an invitation, notification, or integration? Do not infer those answers from the presence of an Upload button.
Use a sanitized example of a successful file and a deliberately invalid one. Record both the screen result and the resulting database changes. If current behavior is unsafe, agree on the correction rather than reproducing it silently.
Write a six-part import contract
A short agreement about observable behavior prevents two teams from calling different results “the same import.” Capture these six decisions before implementation:
File format: accepted encoding, delimiter, headers, quoting, maximum size and row count. Decide whether unknown or repeated headers are rejected or explicitly mapped.
Field meaning: required fields, leading zeros, whitespace, blank versus missing values, dates, decimal notation and allowed statuses. Specify which fields a blank cell may clear.
Record matching: the stable business key, its customer or workspace scope, and the outcome when a key is missing or appears twice.
Write policy: create-only, update-only or explicitly allowed create-and-update behavior; fields that imports must never overwrite.
Failure policy: whether one invalid row blocks the whole file or valid rows may commit; how a user corrects and retries the rejected rows.
Completion evidence: an import identifier, durable status, row outcomes, counts and any downstream actions that remain pending.
Do not let a parser guess business rules. The value 00127 may be an identifier, not the number 127. An empty quantity may mean “leave unchanged,” “clear,” or “invalid”—those are different operations. Date interpretation belongs in the same agreement; the dates and time zones guide covers that boundary in more depth.
CSV itself needs deliberate parsing. RFC 4180 describes quoted fields containing commas, line breaks and escaped double quotes. Splitting text on commas and newlines is not a reliable substitute for a CSV parser. The RFC documents a common format, not every spreadsheet variant your customers may export. Test the variants you choose to support.
Separate validation from committing changes
Show users a preview of interpreted values and intended actions before a consequential import. A preview should answer “which records will change?” rather than merely display the first few raw rows.
Validate the complete supported file, including relationships and duplicate keys, before calling it ready. Resolve linked records within the uploader's authorized workspace. A valid identifier is not permission to update the record behind it, and a file-supplied workspace column should not override the server's authorization checks.
Validation can become stale. Another user may edit a matching record after the preview. At commit time, recheck authorization and relevant constraints. Decide whether a changed record stops the import, produces a row conflict, or can be updated under an explicitly agreed rule. Avoid silently overwriting a newer manual correction.
All-or-nothing and partial-success imports are both possible product choices. They must not be accidental consequences of batch size.
For all-or-nothing database changes, PostgreSQL transactions provide a mechanism to commit grouped writes together or discard them. That does not automatically undo an email or a request already sent to another service. Stage external actions separately and give them their own completion and retry rules.
For partial success, persist a result for each row. Users need to know which rows were committed, rejected, skipped or left pending. If large files are processed in chunks, define whether “cancel” stops future chunks or also reverses earlier changes. Do not promise whole-file rollback when the implementation only stops the remaining work.
Make retries different from new imports
A second click is not reliable evidence that the user wants a second set of records. Give a submitted import a durable identifier and let the user reopen its status after a browser refresh or lost connection.
Keep two kinds of identity separate: the identity of the import attempt and the identity of each business record. A filename is neither. A file fingerprint can help recognize identical input, but the same bytes might be intentionally submitted later for a different business purpose. Define when to resume, reject, or ask for confirmation.
Enforce the agreed record key at the database boundary, not only with a “search, then create” sequence. For example, a catalog identifier may need to be unique within one workspace rather than across every customer. PostgreSQL's ON CONFLICT behavior can support a chosen conflict policy, but it does not decide which fields an import should overwrite. “Upsert everything” is not a business rule.
Persist each row outcome or processing checkpoint atomically with its corresponding database mutation where they share a transactional database. Otherwise, a crash between writing the record and recording its result can make a completed row look unprocessed. If those records live in different systems, design and test an explicit reconciliation mechanism.
After an interrupted connection, reconcile the saved import result before replaying writes. Do the same for downstream invitations or integration calls. A database row that was created once can still generate two emails if its external action is retried without its own duplicate protection.
Prove the result with a small adversarial file
Here is a fictional acceptance scenario, not a client case. A workspace imports catalog items using external_code as its key. The agreed policy is create-only, partial success: existing workspace keys are skipped without modification, and every repeated key inside one file is rejected for correction.
The file contains five data rows: two different rows with code A-10, one valid new B-20, one row missing a required name, and one code C-30 that already exists in the workspace.
The expected first result is one created record, three rejected rows and one skipped existing record. A-10's two rows are both rejected; the missing-name row is rejected; B-20 is created; C-30 remains unchanged. The five row outcomes reconcile to five input rows. Reopening or retrying this same completed import must not create another B-20.
Your product may choose a different policy. The value of this fixture is that the expected outcome is written down and can be checked. Add these variations to the migration test set:
Reorder columns and include a quoted comma, a quoted line break and a leading-zero identifier. Confirm values, not just row counts.
Submit the same import twice while the first is running. Verify one agreed outcome and a usable status screen.
Interrupt the connection after writes commit but before the browser receives success. Reopen the result without blindly repeating writes.
Change a target record or revoke the uploader's permission after preview. Check the agreed conflict and access response.
Include a linked record from another workspace. It must not become accessible or editable through the importer.
Fail one downstream action after the database work succeeds. Show that action as pending or failed and retry it without duplicating completed effects.
Run these checks in a test environment with synthetic data and safe test recipients. An error report should identify the row and problem without unnecessarily exposing sensitive values; treat downloadable reports as customer data too.
Carry unfinished imports across cutover
Before moving traffic, inventory queued, running and partially completed imports. Decide which system owns each one. Either finish it in Bubble, transfer enough state to resume safely, or stop it with a clear customer-visible outcome. Starting every uploaded file again in the new system is not a migration plan.
Preserve the identifiers, row results and downstream-action history needed to recognize completed work. Keep old status links working or explain where users can retrieve their results. This is a specific input to the broader cutover and recovery plan, not a reason to invent a separate launch process.
The handover should include the supported template, matching and overwrite rules, failure policy, acceptance fixtures and instructions for investigating an interrupted import. A successful demo of one clean file is not enough.
Sources
- 01Upload data as CSV action · Bubble Docs
- 02RFC 4180 · rfc-editor.org
- 03PostgreSQL transactions · PostgreSQL Docs
- 04ON CONFLICT behavior · PostgreSQL Docs
Keep reading
Bubble to Code is an independent service. Not affiliated with, endorsed by, or sponsored by Bubble Group, Inc.
