define Cell Data Format
See original GitHub issueIs there a way to enforce Cell Data Format for empty cells?
I generate the sheet with:
const ws = XLSX.utils.aoa_to_sheet([['column 1', 'column 2', 'column 3']]);
const wb = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(wb, ws, 'SheetJS');
const contents = XLSX.write(wb, { type: 'buffer', bookType: 'xlsx' });
however, after downloading the sheet and opening it in Numbers the Data Format is automatic. I want to enforce this to be text.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:10 (3 by maintainers)
Top Results From Across the Web
Cell Formatting
Cell formats allow you to change the way cell data appears in the spreadsheet. · The formatting options allows for monetary units, scientific...
Read more >Change the format of a cell - Microsoft Support
You can apply formatting to an entire cell and to the data inside a cell—or a group of cells. One way to think...
Read more >Format Cells in Excel (Easy Tutorial)
When we format cells in Excel, we change the appearance of a number without changing the number itself. We can apply a number...
Read more >Excel 2013: Formatting Cells - GCF Global
Text formats numbers as text, meaning what you enter into the cell will appear exactly as it was entered. Excel defaults to this...
Read more >What is Format Cells in Excel?
Format Cells : - Excel cell format option is used for changing the appearance of number without any changes in number. We can...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Samples:
To find the formats, run in NodeJS:
So forcing “Text” seems to be a matter of setting the cell number format to Text (
@
in Excel).This normally would be
However there is a logical bug in the cell filtering. Feel free to submit a PR:
Ah, npm website’s latest version is still 0.18.5, I didn’t notice you changed the installation to provide package yourself. 😅 Thanks for the heads up, I have a workaround so I’ll wait for next release.