Get started with exceljs CDN

MIT licensed

Node.js library: ExcelJS - creates, reads, writes Excel files in Office Genesis format.

Tags:
  • xlsx
  • json
  • csv
  • excel
  • font
  • border
  • fill
  • number
  • format
  • number format
  • alignment
  • office
  • spreadsheet
  • workbook
  • defined names
  • data validations
  • rich text
  • in-cell format
  • outlineLevel
  • views
  • frozen
  • split
  • pageSetup

Stable version

Copied!

How to start using exceljs CDN


const ExcelJS = require('exceljs');

// Create a workbook and load a new workbook file
const workbook = new ExcelJS.Workbook();
workbook.xlsx.readFile('output.xlsx')
  .then(() => {
    // Create a new worksheet
    const worksheet = workbook.addWorksheet('New worksheet');

    // Prepare data to write
    const data = [
      ['Name', 'Age'],
      ['John Doe', 30],
      ['Jane Doe', 28],
    ];

    // Write data to worksheet
    worksheet.addRows(data);

    // Save the workbook
    return workbook.xlsx.writeFile('output.xlsx');
  })
  .then(() => {
    console.log('Data written to file successfully.');
  })
  .catch((err) => {
    console.error('Error writing data to file:', err);
  });

// Load the ExcelJS library from the CDN
const ExcelJS_CDN = document.createElement('script');
ExcelJS_CDN.src = 'https://cdn.cdnhub.io/exceljs/4.4.0/exceljs.min.js';
document.head.appendChild(ExcelJS_CDN);

// Wait for the library to load before running the example
ExcelJS_CDN.onload = () => {
  // Run the example here
};
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!

All versions