Skip to content

Anyway to tell sheet_to_json to output with the cell's value instead of text? #169

@rdmurphy

Description

@rdmurphy

Hello!

Been using XLSX.utils.sheet_to_json, but hit a snag. The Excel workbook has a sheet with cells filled with integers. But when I run sheet_to_json, it spits them out as strings.

Using this as the example:

A2: { t: 'n', v: 1995, w: '1995' },
B2: { t: 'n', v: 27, w: '27' },
C2: { t: 'n', v: 4, w: '4' },

I assume this is because it fills out object with the cell's text representation – w – instead of v. Is there anyway for me to tell it to use v instead?

I'm currently looping through the generated object to alter the keys I know should be numbers, but this tool would ideally not require the user to customize the converter per sheet. That could quickly get out of hand.

Thanks!

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