Skip to content

Commit bd5da08

Browse files
author
Mathieu-ai
committed
fix: - $ExcelToJson
1 parent 41e35f7 commit bd5da08

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "generic-functions.mlai",
3-
"version": "0.0.4",
3+
"version": "0.0.45",
44
"description": "Some generic functions that can be used by anyone",
55
"main": "dist/cjs/index.js",
66
"module": "dist/esm/index.js",

src/library/Properties.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -832,10 +832,9 @@ export function $ExcelToJson(pathOfFile: any) {
832832
val = worksheet[z].v;
833833

834834
//header names
835-
let colName = headers[col];
836835
if (row == 1) {
837836
// if val have '\n' in the string
838-
if (val) colName = $removeBreakLines(val);
837+
if (val) headers[col] = $removeBreakLines(val);
839838
continue;
840839
}
841840
if (!val || val == '') val = false;
@@ -844,7 +843,7 @@ export function $ExcelToJson(pathOfFile: any) {
844843
// tbData[row] = object identifier (aka: {code: 6})
845844
if (!tbData[row]) tbData[row] = {};
846845
// value of column
847-
tbData[row][colName] = val;
846+
tbData[row][headers[col]] = val;
848847
}
849848

850849
//remove first two rows because empty

0 commit comments

Comments
 (0)