fix(web-test): adaptive header detection threshold for narrow spreadsheets

Hardcoded threshold of 3 non-empty cells prevented header detection in
spreadsheets with 1-2 columns (e.g. query console results). Use
Math.min(3, maxCol + 1) so narrow tables can still be parsed structurally.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Nick Shirokov
2026-04-04 19:19:24 +03:00
parent b008c820f9
commit ffc34904c5
+1 -1
View File
@@ -1056,7 +1056,7 @@ function buildSpreadsheetMapping(allCells) {
// Find header rows
let detailIdx = -1;
for (let i = firstDataIdx - 1; i >= 0; i--) {
if (nonEmpty(rows[i]) >= 3) { detailIdx = i; break; }
if (nonEmpty(rows[i]) >= Math.min(3, maxCol + 1)) { detailIdx = i; break; }
}
if (detailIdx === -1) return null; // no headers detected