Skip to content

fix(import): keep leading zeros and quoted spreadsheet cells in pasted data - #1390

Open
Xnadir wants to merge 1 commit into
TabularisDB:mainfrom
Xnadir:fix/clipboard-import-zeros-and-quoted-tsv
Open

Xnadir wants to merge 1 commit into
TabularisDB:mainfrom
Xnadir:fix/clipboard-import-zeros-and-quoted-tsv

Conversation

@Xnadir

@Xnadir Xnadir commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Two ways Import from Clipboard (and .tsv file import, which uses the same parser) loses data:

1. Leading zeros are dropped. ZIP codes, phone numbers and ids such as 00123, 0612345678 or 007 were inferred as INTEGER, so the created column stores 123, 612345678 and 7. A number with a leading zero is now inferred as TEXT. 0 itself and decimals like 0.5 are still numeric, and the type can still be changed in the dialog.

2. Multi-line cells from a spreadsheet break the rows. Excel and Google Sheets quote a copied cell that holds a line break, a tab or a quote, and double the quotes inside it:

name	note
Alice	"line 1
line 2"

The TSV parser split on every line break, so this became two rows, ["Alice", "\"line 1"] and ["line 2\""]. It now reads a quoted field when its closing quote ends the cell, meaning it's followed by a tab, a line break or the end of the text, and un-doubles "". Any other quote stays plain text, so 5" and "quoted" text are unchanged. CRLF inside and between cells works too.

Testing

  • tests/utils/clipboardParser.test.ts (6 new tests):
    • a quoted cell with a line break;
    • doubled quotes and a tab inside a quoted cell;
    • CRLF inside and between quoted cells;
    • quotes that don't wrap the whole cell staying as text;
    • ZIP and phone columns inferred as TEXT while plain ids stay INTEGER;
    • 0 and 0.5 staying numeric.
  • pnpm typecheck ✅, ESLint (no warnings) and Prettier on the changed files ✅.
  • Full vitest run: 498 files, 8075 tests, all passing.

AI assistance: found and written with Claude Code, tested as above.

🤖 Generated with Claude Code


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

…d data

Import from Clipboard (and TSV file import) had two ways to lose data:

- Values such as 00123, 0612345678 or 007 were inferred as INTEGER, so
  the created column dropped their leading zeros (ZIP codes, phone
  numbers, ids). A number with a leading zero is now inferred as TEXT;
  0 itself and decimals like 0.5 stay numeric.
- Excel and Google Sheets quote a copied cell that holds a line break,
  a tab or a quote, and double the quotes inside. The TSV parser split
  such a cell at its line break into separate rows and kept the quotes.
  It now reads a quoted field when the closing quote ends the cell
  (followed by a tab, a line break or the end); any other quote, as in
  5" or "quoted" text, stays plain text.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings November 5, 2026 09:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@kilo-code-bot

kilo-code-bot Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (2 files)
  • packages/web-ui/src/utils/clipboardParser.ts
  • packages/web-ui/tests/utils/clipboardParser.test.ts

Reviewed by claude-sonnet-5.5 · Input: 252 · Output: 2K · Cached: 227.6K

Review guidance: REVIEW.md from base branch main

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants