-
-
Notifications
You must be signed in to change notification settings - Fork 8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
date format in sheet_to_json #705
Comments
set maybe I solve my question, I wanna cry!😭 |
@zhangge3992513 set If you know that certain dates are really times, then change those cells! Here's how you change the format of cell B2 in sheet Sheet1: var worksheet = workbook.Sheets['Sheet1'];
var cell = worksheet['B2'];
delete cell.w; // remove old formatted text
cell.z = 'h:mm:ss'; // set cell format
/* OPTIONAL */
XLSX.utils.format_cell(cell); // this refreshes the formatted text. |
Well, thank you. That solves my problem.But I don't think it's a very good way. |
The real problem is the default date format is localized. See #326 (comment) for a larger discussion. If you set your computer settings to US English, you will see This is a known issue with our formatter library https://github.com/SheetJS/ssf, so we'll mark this issue as closed and update once we figure out international support |
Is there a way to get the formatted date and time strings (unaltered just as recorded in the spreadsheet) in the JSON output? The cellDates formatter option converts it to UTC and changes the date or time. It appears that cellText: true is what I need, but when I have that enabled I just get numbers in the JSON Date and Time fields. My code is coded to sheet_to_json but due to the logic I need, I'm finding it very hard to lookup the cell from any point in the JSON. If I could, I'm after the w value from any place in the JSON. > wb.Sheets.WebhookTest.R2
{ t: 'n', v: 44084, w: '10/09/2020' }
> wb.Sheets.WebhookTest.S2
{ t: 'n', v: 44091.3958333333, w: '9:30 AM' } |
const rows = XLSX.utils.sheet_to_json(workbook.Sheets[sheet], {raw: false} |
set {cellDates: true ,dateNF: "DD-MMM-YYYY"} |
How do I get the content in the excel table without converting the format?
I don't want to convert it.
in my excel,has a auto format cell : 2017/6/13 14:13:12
xlsx get that: 6/13/17 14:13
I need the data: 2017/6/13 14:13:12
and I need to save the data to postgresql
The text was updated successfully, but these errors were encountered: