Skip to content

Commit

Permalink
processMergedCells wants col count not row count
Browse files Browse the repository at this point in the history
  • Loading branch information
rossjones committed Sep 12, 2024
1 parent 4324cfb commit b2036e2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/importer/sheets.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ function processMergedCells(wantedColumns, preview) {
// Given a session and a sheet name, gets a preview of the data held there
// returning either a 2dim array of rows/cells or null if that specific sheet
// is empty.
exports.GetPreview = (session, sheet) => {
exports.GetPreview = (session, sheet, count=10) => {
const dimensions = backend
.SessionGetInputDimensions(session.backendSid)
.sheetDimensions.get(sheet);
Expand All @@ -115,7 +115,7 @@ exports.GetPreview = (session, sheet) => {
sheet: sheet,
start: {row: 0, column: 0},
end: {row: dimensions.rows, column: dimensions.columns > 0 ? dimensions.columns - 1 : 0 }
}, Math.min(10, dimensions.rows), 0, 0)[0];
}, Math.min(count, dimensions.rows), 0, 0)[0];

// TODO: Is there a better way to tell if the sheet is empty than iterating
// all the cells? - we should have something in SessionGetInputDimensions
Expand All @@ -131,7 +131,7 @@ exports.GetPreview = (session, sheet) => {
return null;
}

return processMergedCells(Math.min(10, dimensions.rows), preview);
return processMergedCells(dimensions.columns, preview);
};


Expand Down

0 comments on commit b2036e2

Please sign in to comment.