(filepath)
| 7 | /* eslint-disable */ |
| 8 | |
| 9 | function main(filepath) { |
| 10 | const Excel = require('../lib/exceljs.nodejs.js'); |
| 11 | |
| 12 | const workbook = new Excel.Workbook(); |
| 13 | |
| 14 | const worksheet1 = workbook.addWorksheet('Sheet1'); |
| 15 | worksheet1.addRows([ |
| 16 | ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H'], |
| 17 | ['a1', 'b1', 'c1', 'd1', 'e1', 'f1', 4, 5], |
| 18 | ['a1', 'b2', 'c1', 'd2', 'e1', 'f1', 4, 5], |
| 19 | ['a2', 'b1', 'c2', 'd1', 'e2', 'f1', 14, 24], |
| 20 | ['a2', 'b2', 'c2', 'd2', 'e2', 'f2', 24, 35], |
| 21 | ['a3', 'b1', 'c3', 'd1', 'e3', 'f2', 34, 45], |
| 22 | ['a3', 'b2', 'c3', 'd2', 'e3', 'f2', 44, 45], |
| 23 | ]); |
| 24 | |
| 25 | const worksheet2 = workbook.addWorksheet('Sheet2'); |
| 26 | worksheet2.addPivotTable({ |
| 27 | // Source of data: the entire sheet range is taken; |
| 28 | // akin to `worksheet1.getSheetValues()`. |
| 29 | sourceSheet: worksheet1, |
| 30 | // Pivot table fields: values indicate field names; |
| 31 | // they come from the first row in `worksheet1`. |
| 32 | rows: ['A', 'B', 'E'], |
| 33 | columns: ['C', 'D'], |
| 34 | values: ['H'], // only 1 item possible for now |
| 35 | metric: 'sum', // only 'sum' possible for now |
| 36 | }); |
| 37 | |
| 38 | save(workbook, filepath); |
| 39 | } |
| 40 | |
| 41 | function save(workbook, filepath) { |
| 42 | const HrStopwatch = require('./utils/hr-stopwatch'); |
no test coverage detected
searching dependent graphs…