@gatekeeper_technology/excel-utils 1.0.8 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/package.json +1 -1
- package/workbook_creator.js +17 -0
package/README.md
CHANGED
package/package.json
CHANGED
package/workbook_creator.js
CHANGED
|
@@ -62,6 +62,23 @@ let WorkbookCreator = class {
|
|
|
62
62
|
return worksheet;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
+
/**
|
|
66
|
+
* Load data into worksheet
|
|
67
|
+
* @param {ExcelJS.Worksheet} worksheet Worksheet
|
|
68
|
+
* @param {string[][]} data Data array
|
|
69
|
+
* @param {number} offset Number of rows to skip before writing data
|
|
70
|
+
* @returns {ExcelJS.Worksheet} The created workbook
|
|
71
|
+
*/
|
|
72
|
+
loadDataIntoWorksheetWithRowOffset(worksheet, data, row_offset) {
|
|
73
|
+
for (let _row_data of data.entries()) {
|
|
74
|
+
// Get a row object. If it doesn't already exist, a new empty one will be returned
|
|
75
|
+
let row = worksheet.getRow(row_offset + 1);
|
|
76
|
+
row.values = _row_data;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return worksheet;
|
|
80
|
+
}
|
|
81
|
+
|
|
65
82
|
/**
|
|
66
83
|
* Save workbook as XLSX
|
|
67
84
|
* @param {ExcelJS.Workbook} workbook Workbook
|