Sunday 1 August 2021

Load and Save .xlsx file while maintaining format

How do you load and save an excel file (.xlsx) while maintaining the formatting?

Using exceljs, I've done the following:

const Excel = require('exceljs');

// read from a file
const run = async () => {
    const workbook = new Excel.Workbook();
    await workbook.xlsx.readFile('test.xlsx');

    // ... use workbook
    let options = {
        useStyles: true
    }
    await workbook.xlsx.writeFile('test2.xlsx', options);
}

run();

It loads and saves, but the problem is the formatting is lost.



from Load and Save .xlsx file while maintaining format

No comments:

Post a Comment