How to use the exceljs.Workbook function in exceljs

To help you get started, we’ve selected a few exceljs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github imodeljs / imodeljs / test-apps / testbed / frontend / performance / PerformanceReportWriter.ts View on Github external
public static async startup(inputPath?: string, outputPath?: string): Promise {
    if (undefined !== inputPath)
      PerformanceReportWriter.input = inputPath;
    if (undefined !== inputPath || undefined !== outputPath)
      PerformanceReportWriter.output = undefined !== outputPath ? outputPath : inputPath!;

    // if file doesn't exist, do setup a new file by writing column headers
    const doSetupNewFile = !fs.existsSync(PerformanceReportWriter.input);

    PerformanceReportWriter.dataArray = [];

    if (doSetupNewFile) {
      const wb = new Excel.Workbook();
      const ws = wb.addWorksheet("Performance Results");

      ws.columns = [
        { header: "" },
        { header: "IModel" },
        { header: "View" },
        { header: "Flags" },
        { header: "TileLoadingTime" },
        { header: "Scene" },
        { header: "GarbageExecute" },
        { header: "InitCommands" },
        { header: "BackgroundDraw" },
        { header: "Skybox" },
        { header: "Terrain" },
        { header: "SetClips" },
        { header: "OpaqueDraw" },
github DefinitelyTyped / DefinitelyTyped / types / exceljs / exceljs-tests.ts View on Github external
import * as Excel from 'exceljs';

// most examples taken and adapted from README.md

const workbook = new Excel.Workbook();

workbook.creator = 'Me';
workbook.lastModifiedBy = 'Her';
workbook.created = new Date(1985, 8, 30);
workbook.modified = new Date();
workbook.lastPrinted = new Date(2016, 9, 27);
workbook.properties.date1904 = true;

workbook.views = [
  {
    x: 0, y: 0, width: 10000, height: 20000,
    firstSheet: 0, activeTab: 1, visibility: 'visible'
  }
];

const worksheet: Excel.Worksheet = workbook.addWorksheet('My Sheet');
github rafiudd / import-export-excel-adonisjs / app / Services / ImportService.js View on Github external
static async ImportClassification(filelocation)
    {
        var workbook    = new Excel.Workbook()

        workbook = await workbook.xlsx.readFile(filelocation)

        //console.log(filelocation)
        let explanation = workbook.getWorksheet('Sheet 1') // get sheet explanation (sheet name)
        //console.log('Worksheet', explanation)
        let colComment  = explanation.getColumn('C')//column name
        //console.log(colComment)

            colComment.eachCell(async (cell, rowNumber) => {
                if(rowNumber >= 11){
                    let sekolah = explanation.getCell('B' + rowNumber).value //get cell and the row
                    let kode    = explanation.getCell('C' + rowNumber).value
                    let nama    = explanation.getCell('D' + rowNumber).value
                    let nip     = explanation.getCell('E' + rowNumber).value
github webhintio / hint / packages / formatter-excel / src / formatter.ts View on Github external
public async format(messages: Problem[], options: FormatterOptions = {}) {
        if (messages.length === 0) {
            return;
        }

        const language = options.language!;
        const target = options.target || '';
        const resources: _.Dictionary = _.groupBy(messages, 'resource');
        const workbook = new Excel.Workbook();
        const sortedResources = _.sortBy(Object.keys(resources));

        // Styles for the cells
        const bold = { font: { bold: true } };
        const mediumBorder = { style: 'medium' };
        const border = {
            border: {
                bottom: mediumBorder,
                left: mediumBorder,
                right: mediumBorder,
                top: mediumBorder
            }
        };
        const rightAlign = { align: { horizontal: 'right' } };
        const tableHeader = {
            fill: {
github dominikwinter / mobile-scraper / index.js View on Github external
data.forEach((items) => {
        Object.keys(items.technical).forEach(key => {
            if (possible_technical.indexOf(key) === -1) {
                possible_technical.push(key);
            }
        });

        Object.keys(items.features).forEach(key => {
            if (possible_features.indexOf(key) === -1) {
                possible_features.push(key);
            }
        });
    });

    const workbook = new Excel.Workbook();
    const worksheet = workbook.addWorksheet('My Sheet', {
        views: [
            { xSplit: 1, ySplit: 1, zoomScale: 80 }
        ]
    });

    const headers = [];

    // head
    Object.keys(data[0]).forEach(key => {
        switch (key) {
            case 'technical': return possible_technical.forEach(key => headers.push(key));
            case 'features':  return possible_features.forEach(key  => headers.push(key));
            default:          return headers.push(key);
        }
    });
github imodeljs / imodeljs / test-apps / testbed / frontend / performance / PerformanceReportWriter.ts View on Github external
public static async applyToWorksheet(fnc: (worksheet: Excel.Worksheet) => void): Promise {
    const workbook = new Excel.Workbook();
    return workbook.xlsx.readFile(PerformanceReportWriter.input)
      .then(async () => {
        fnc(workbook.getWorksheet(1));
        return workbook.xlsx.writeFile(PerformanceReportWriter.output);
      });
  }
github commercetools / nodejs / integration-tests / cli / product-json-to-xlsx.it.js View on Github external
function analyzeExcelStream(stream) {
  const workbook = new Excel.Workbook()
  const readStream = workbook.xlsx.createInputStream()
  stream.pipe(readStream)

  return new Promise((resolve, reject) => {
    readStream.on('error', reject)
    readStream.on('done', () => resolve(analyzeExcelWorkbook(workbook)))
  })
}
github newmips / newmips / routes / import.js View on Github external
if (success) {
                                    res.json({
                                        success: success,
                                        sqlFilename: sqlFilename,
                                        message: "Import terminée. Aucune erreur. Fichier SQL des requêtes valide disponible."
                                    });
                                } else {
                                    res.json({
                                        success: success,
                                        sqlFilename: sqlFilename,
                                        message: "Import terminée. Des erreurs sont survenues. Fichier SQL des requêtes valide disponible."
                                    });
                                }
                            });
                        }
                        var workbook = new Excel.Workbook();

                        if(files.contentFile.type === "text/csv"){
                            console.log("--- FICHIER CSV DETECTE ---");
                            workbook.csv.readFile(contentFilePath).then(function(worksheet) {
                                readingDone(worksheet, "CSV", fields.appID, configFile);
                            });
                        }
                        else if(files.contentFile.type === "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"){
                            console.log("--- FICHIER XLSX DETECTE ---");
                            workbook.xlsx.readFile(contentFilePath).then(function(worksheet) {
                                readingDone(worksheet, "XLSX", fields.appID, configFile);
                            });
                        }
                        else{
                            console.log("Error file import extension");
                            req.session.toastr = [{
github ZhiXiao-Lin / nestify / server / src / common / lib / excel.ts View on Github external
static async loadFromBuffer(buffer, sheetsMap) {
        const workbook = new Excel.Workbook();
        await workbook.xlsx.load(buffer);

        return await ExcelHelper.load(workbook, sheetsMap);
    }

exceljs

Excel Workbook Manager - Read and Write xlsx and csv Files.

MIT
Latest version published 7 months ago

Package Health Score

78 / 100
Full package analysis