question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to set cell type?

See original GitHub issue

Given some data like:

const workbook = new Excel.Workbook();
const sheet = workbook.addWorksheet('My Sheet');
const rows = [
    [1, 'Bob', true],
    [2, 'Jake', false]
];

sheet.addRows(rows);

How can I make the sheet column types in the excel file end up being Excel.ValueType.Number, Excel.ValueType.String, Excel.ValueType.ValueType.Boolean?

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:11
  • Comments:6

github_iconTop GitHub Comments

8reactions
nikhilagcommented, May 16, 2020

Is there any update on this? It will be very useful for cases where number is being stored as string or when date timezone needs to be changed on server side.

2reactions
zivlevycommented, Dec 6, 2020

you can change the cell’s format by the following code (in this example I change all cells in col 1 (A) to text format: const cell = worksheet.getColumn(1); cell.eachCell((c, rowNumber) => { c.numFmt = '@'; });

Read more comments on GitHub >

github_iconTop Results From Across the Web

using poi , How to set the Cell type as number
i.e. In the newly create excel , when I right click and go to format cell ->there I always found number to be...
Read more >
Apache POI Excel Cell Type
To set various types of values in cell, Apache POI provides overloading function setCellValue() which allows us to set values as per the...
Read more >
Setting Cell Type in Excel 2010
Right Click on the cell » Format cells » Number. Click on the Ribbon from the ribbon. Set Cell Type. Various Cell Formats....
Read more >
Cell (POI API Documentation) - Apache POI
Set the cells type (blank, numeric, boolean, error or string). If the cell currently contains a value, the value will be converted to...
Read more >
Set a Cell Format as Text in Excel
Open the Excel workbook · Click on the column heading to select entire column · Click Format > Cells · Click the Number...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found