Repository navigation
fix(import): keep leading zeros and quoted spreadsheet cells in pasted data - #1390
Conversation
…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 <[email protected]>
There was a problem hiding this comment.
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.
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (2 files)
Reviewed by claude-sonnet-5.5 · Input: 252 · Output: 2K · Cached: 227.6K Review guidance: REVIEW.md from base branch |
debba
left a comment
There was a problem hiding this comment.
Thanks for tackling both parts of the clipboard import problem. The multiline TSV cases, including doubled quotes and CRLF, are useful coverage, and keeping leading-zero codes as text is a welcome fix. I haven't found an obvious blocker in the diff. I'll run e2e tests for further verification, then merge if those pass.
|
I tried two real clipboard imports into SQLite. Leading-zero ZIP codes stayed as text, and multiline cells, embedded tabs and doubled quotes reached the database intact. A CRLF sample with 0, 0.5 and 12 still inferred a numeric column, while ordinary quotes stayed literal. Lint, typecheck and the full test suite passed. This is ready to merge. Thanks! |
Two ways Import from Clipboard (and
.tsvfile import, which uses the same parser) loses data:1. Leading zeros are dropped. ZIP codes, phone numbers and ids such as
00123,0612345678or007were inferred asINTEGER, so the created column stores123,612345678and7. A number with a leading zero is now inferred asTEXT.0itself and decimals like0.5are 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:
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, so5"and"quoted" textare unchanged. CRLF inside and between cells works too.Testing
tests/utils/clipboardParser.test.ts(6 new tests):TEXTwhile plain ids stayINTEGER;0and0.5staying numeric.pnpm typecheck✅, ESLint (no warnings) and Prettier on the changed files ✅.vitest run: 498 files, 8075 tests, all passing.AI assistance: found and written with Claude Code, tested as above.
🤖 Generated with Claude Code
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.