disambiguate duplicate header names #194
No reviewers
Labels
No Label
DBF
Dates
Defined Names
Features
Formula
HTML
Images
Infrastructure
Integration
International
ODS
Operations
Performance
PivotTables
Pro
Protection
Read Bug
SSF
SYLK
Style
Write Bug
good first issue
No Milestone
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: sheetjs/sheetjs#194
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "master"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
If multiple columns have the same header, rename subsequent columns to HEADER_1, HEADER_2, etc.
@patricklam so if I'm reading the code correctly (haven't tested it), if the table is
then the row object will be
Do we want to rename the first Bar to Bar_1 ?
@notatestuser @nathanathan thoughts?
The first ambiguous one will be "Bar_1" not "Bar_2" right now. That's kind
of like what happens when you download files and you have a duplicate,
which then gets called File (1) or whatever. I'm indifferent as to what it
is exactly, just have to pick something. It would be another 5 minutes of
implementation to rename the first Bar.
On Sat, Mar 28, 2015 at 11:27 PM, SheetJSDev notifications@github.com
wrote:
Is this implemented in the current version? I have a concern that when the headers are [Bar, Bar, Bar_1] will the fix work fine?
+1
Is there way to disable this?
If you are running into this issue @r1z1a that means your data file has multiple column headers with the same value, like the example from an earlier post in the thread:
The old behavior used the last column, so you would have seen
{Foo:1,Bar:5}
. The current behavior disambiguates so you would see{Foo:1,Bar:2,Bar_1:3,Bar_2:4,Bar_3:5}
. If you really want to do it, you can generate custom headers in an array and pass it to sheet_to_json, as shown in the README:XLSX.utils.sheet_to_json(ws, {header:['Foo', undefined, undefined, undefined, 'Bar']})
Pull request closed