Reputation: 614
I am using ExcelJS package when I retrieve some cells value, it doesn't return the values inside instead it returns some sort of format that I think is a date format sort of.
const workbook = new Excel.Workbook ();
workbook.csv.readFile(path)
.then(worksheet => {
const seenCell = worksheet.getCell('A3').value;
console.log(seenCell);
}
When I run this code try to get cell A4 it returns the content which is a string, but trying to get cell A3 returns
2027-02-11T23:00:00.000Z
I will like to know which format this is, it looks like a date to me and my data is not date.
Upvotes: 1
Views: 1495
Reputation: 2654
Since CSV files don't contain any information about data types, ExcelJS tries to guess: anything that even remotely looks like a date is converted to a Date. But the test isn't perfect, and something like 123-456-7890
gets converted to 7891-01-13T22:00:00.000Z
.
You can disable date detection by passing empty dateFormats list,
e.g. workbook.csv.readFile('foo.csv', {dateFormats:[]})
.
Upvotes: 3