Exporting Date-Times in Iso Format #640
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#640
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
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?
I want to export date/time values to JSON formatted as ISO 8601 values
My current script:
The cells itself already contain the correct datetime inside the v(alue) attribute.
I suggest an option like
XLSX.utils.sheet_to_json(sheet, {header: 1, ExportDatesAsISO:true});
Test data:
datum.xlsx
This script would work for me but feels just wrong:
Would it make more sense to add an option that suppresses the formatted text for all cells? something like
cellText
which would not generate the.w
text if it is set tofalse
?This would help; the parsing through the cells could be avoided.
But even then it is not possible to return the date in ISO format, as YYYY-MM-DDThh:mm:ss is not accepted as dateNF.
@SCullman so the first part was pushed (
cellText:false
will not generate the format).For your specific format, the correct code is
YYYY-MM-DD"T"hh:mm:ss
. The double-quotes are necessary to indicate that T is a literal T and not a format element. If you try to enterYYYY-MM-DDThh:mm:ss
and save the file, the actual format is encoded in the xml asThank you, works perfect!