-
-
Notifications
You must be signed in to change notification settings - Fork 8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Export xlsx file with a "number" cell format #966
Comments
Unfortunately the utility doesn't have an option to set the format for a column, but you can manually walk the cells: Number formats are stored in the To manually change cells, use a walk similar to the README example: /* new format */
var fmt = "0.00";
/* change cell format of range B2:D4 */
var range = { s: {r:1, c:1}, e: {r:2, c:3} };
for(var R = range.s.r; R <= range.e.r; ++R) {
for(var C = range.s.c; C <= range.e.c; ++C) {
var cell = ws[XLSX.utils.encode_cell({r:R,c:C})];
if(!cell || cell.t != 'n') continue; // only format numeric cells
cell.z = fmt;
}
} Here's a live example: https://jsfiddle.net/1ny97xrb/1/ @SheetJSDev: eventually |
thanks for the answer ! I'll try it ASAP |
Really useful answer from @reviewher. The only thing I could not figure out was how to format the entire column instead of the individual cells? If anyone has a suggestion, I would be very grateful... |
Thank you very much... |
I really enjoy working with this lib. really great work !
As mentioned in the title im exporting an excel file from an array of arrays and would like to change the cell format from "standard" to "number"
any idea how ca i achieve that please. thanks a lot!
The text was updated successfully, but these errors were encountered: