Skip to content

Commit

Permalink
feat: Add missing text for cells that did not find a value in Excel s…
Browse files Browse the repository at this point in the history
…heet
  • Loading branch information
gregfrasco committed May 9, 2023
1 parent e86d293 commit 10dee09
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion client/src/utils/file.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class FileUtils {
static cleanSheet(sheet: XLSX.WorkSheet): XLSX.WorkSheet {
const cells = Object.keys(sheet);
cells.forEach((cell) => {
if (sheet[cell].t === 's') {
if (sheet[cell] && sheet[cell].t === 's' && sheet[cell].v) {
sheet[cell].v = this.cleanText(sheet[cell].v);
}
});
Expand All @@ -32,6 +32,9 @@ export class FileUtils {
}

static readCell(sheet: XLSX.WorkSheet, cell: string): number {
if (!sheet[cell]) {
return 'MISSING!' as any;
}
return Number(sheet[cell].v);
}
}

0 comments on commit 10dee09

Please sign in to comment.