Skip to content

Problem exporting Date to Cell #1538

@msiqueira-dev

Description

@msiqueira-dev

After reading the documentation, we discovered that we can get a cell reference by using:

cellref = XLSX.utils.encode_cell({ c: col, r: R });

With that variable mentioned before, cellref, we can get into it's properties like .v for value, .s for style and .t for type, and we been informed by e-mail that we can also access .z, witch receives a string and we need to setup a value for it in order to date to work correclty on excel.

Our real problem is that we been strugling to get it work for type (.t) of date ('d'). We tried to apply a date value treated as DD/MM/YYYY or MM/DD/YYYY and both of them got a final result on excel modified, with a different date. I used console.log() to get the value from cellref.v the last moment I had access to it and the date was with the correct value, but in Excel file it usually had one day less. We tried another approach to solve this out, that was to give on the .v a value as a Serial Number Value, that excel accepts and converts do Date. I managed to get a working function that calculates the value. If I get that value from console.log and paste on Excel field with type Date, the number is correclty converted into the corrected date. But when using the XLSX application, giving the .v that serial number value does not work and the date shown to me is 12/31/1969, witch is a default date for invalid date problem.

On the contact via e-mail I got informed to open a Ticket here for further support. I also don't really get what value I must assign to .z in other to get it work. Also, if any of you give me the right solution, please tell me if that should be applied with Serial Number value or just a Date pattern from JavaScript.

Thank you

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions