Skip to content

Commit

Permalink
Support undefined start and end rows
Browse files Browse the repository at this point in the history
  • Loading branch information
hoontee committed Aug 30, 2024
1 parent 666aaa6 commit 7efc577
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Lync/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1398,6 +1398,13 @@ async function fetchSources() {
sheet = excelFile.Sheets[excelFile.SheetNames[0]]
range = XLSX.utils.decode_range(tableDefinitions.ref.replace('=', ''))
}

// Support undefined start and end rows
const hasHeader = tableDefinitions.hasHeader
if (range.s.r == -1)
range.s.r = 0
if (range.e.r == -1)
range.e.r = parseInt(sheet['!ref'].split(':')[1].replaceAll(/[^0-9]/gm, '')) - 1

// Convert cells to dict
const sheetJson = XLSX.utils.sheet_to_json(sheet, {
Expand All @@ -1406,7 +1413,6 @@ async function fetchSources() {
defval: null
})
const entries = tableDefinitions.numColumnKeys > 0 && {} || []
const hasHeader = tableDefinitions.hasHeader
const startRow = hasHeader && 1 || 0
const startColumn = tableDefinitions.numColumnKeys
const lastColumnKeyUsesIndices = tableDefinitions.lastColumnKeyUsesIndices
Expand Down

0 comments on commit 7efc577

Please sign in to comment.