Sheetjs: cell style is not working in XLSX module

Created on 18 Oct 2018  路  3Comments  路  Source: SheetJS/sheetjs

Hi am trying to export my data(json) into an excel sheet using XLSX , only value is getting set using cell.v but styles are not getting set using cell.s . Below is the code snippet .

Node version - v8.11.1
NPM version - 5.6.0

const worksheet: XLSX.WorkSheet = XLSX.utils.json_to_sheet(json);
const workbook: XLSX.WorkBook = { Sheets: { 'Report': worksheet }, SheetNames: 'REPORT' };

worksheet['A1'].v='test value';
worksheet['A1'].s = {fill:{fgColor: {rgb:"86BC25"}}};
const data: Blob = new Blob([buffer], {type: EXCEL_TYPE});
FileSaver.saveAs(data, fileName + new Date().getTime() + EXCEL_EXTENSION);

Kindly let me know if anything is missing here .

Also, i tried replacing XLSX with XLSX-populate , but it says xlsx-populate not found .

All 3 comments

me too

me too

For anyone wondering in the future. Styling cells is a pro feature of SheetJS.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jamesbillinger picture jamesbillinger  路  4Comments

seanmcilvenna picture seanmcilvenna  路  3Comments

sangpuion picture sangpuion  路  3Comments

nishthasb picture nishthasb  路  4Comments

goxr3plus picture goxr3plus  路  3Comments