@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 CHANGED
@@ -1,6 +1,9 @@
1
1
  # Gatekeeper's Excel Utils
2
2
 
3
3
  ## Changelog
4
+ ### [1.00.09] 24-08-2022
5
+ ### Added
6
+ - Ability to load data into worksheet with row offset.
4
7
  ### [1.00.08] 24-08-2022
5
8
  ### Added
6
9
  - Ability to get worksheet by name.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gatekeeper_technology/excel-utils",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "description": "Gatekeeper's excel Utils - shared in NPM",
5
5
  "author": "David Holtzhausen",
6
6
  "main": "index.js",
@@ -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