mirror of
https://github.com/nocodb/nocodb.git
synced 2026-04-29 16:37:09 +00:00
fix: handle spreadsheet with empty header
Signed-off-by: Pranav C <pranavxc@gmail.com>
This commit is contained in:
@@ -46,7 +46,9 @@ export default class ExcelTemplateAdapter extends TemplateGenerator {
|
||||
this.data[sheet] = []
|
||||
const ws = this.wb.Sheets[sheet]
|
||||
const range = XLSX.utils.decode_range(ws['!ref'])
|
||||
const rows = XLSX.utils.sheet_to_json(ws, { header: 1, blankrows: false, cellDates: true })
|
||||
const rows = XLSX.utils.sheet_to_json(ws, { header: 1, blankrows: false, cellDates: true, defval: null })
|
||||
|
||||
// const colLen = Math.max()
|
||||
|
||||
for (let col = 0; col < rows[0].length; col++) {
|
||||
let cn = (rows[0][col] ||
|
||||
@@ -88,6 +90,7 @@ export default class ExcelTemplateAdapter extends TemplateGenerator {
|
||||
vals = vals.filter(v => v !== null && v !== undefined)
|
||||
|
||||
// check column is multi or single select by comparing unique values
|
||||
// todo:
|
||||
if (vals.some(v => v && v.toString().includes(','))) {
|
||||
const flattenedVals = vals.flatMap(v => v ? v.toString().split(',') : [])
|
||||
const uniqueVals = new Set(flattenedVals)
|
||||
|
||||
Reference in New Issue
Block a user