Skip to content
Genom

Search across the sheets of a workbook

Find a value in a workbook that is mostly not rendered.

.xlsx.xlsOne package, every generation — @genomdev/xlsx

Running here, in this pageNothing is uploaded

Virtualisation means most of a large workbook is not in the DOM at any moment, which is exactly why searching the DOM does not work. The index comes from the parsed model, so a hit in row 40,000 of the fourth sheet is found immediately and painted when you scroll to it.

const search = await viewer.search();
const hits = search.find('invoice');

// Every hit is painted, including on pages that are not mounted:
// the index is built from the model, not from the DOM.
search.highlight(hits);

Put it in your own application

What is above is the published package running in this page, with nothing behind it. The documentation covers the same ground with the API in full.