Across xlwings.js:
This loads the full worksheets collection (worksheets.load("items")) just to access a single sheet by index. If Office.js supports it in your target runtime, prefer context.workbook.worksheets.getItemAt(action.sheet_position) to avoid loading/syncing all worksheets and reduce overhead on large workbooks.
Loading values:
Optimize getBookData() Without Architecture Change
Idea: Keep loading all sheets but make it faster.
Optimizations:
Skip sheets with empty used range
Only load values (skip numberFormatCategories when not needed)
Batch context.sync() calls more efficiently
Use getUsedRangeOrNullObject to avoid loading huge empty areas
Parallelize sheet loading where possible (Office.js batching)
Across xlwings.js:
This loads the full worksheets collection (worksheets.load("items")) just to access a single sheet by index. If Office.js supports it in your target runtime, prefer context.workbook.worksheets.getItemAt(action.sheet_position) to avoid loading/syncing all worksheets and reduce overhead on large workbooks.
Loading values:
Optimize getBookData() Without Architecture Change
Idea: Keep loading all sheets but make it faster.
Optimizations:
Skip sheets with empty used range
Only load values (skip numberFormatCategories when not needed)
Batch context.sync() calls more efficiently
Use getUsedRangeOrNullObject to avoid loading huge empty areas
Parallelize sheet loading where possible (Office.js batching)