Getting started with the Spreadsheet Engine
In this guide we’ll install GRID’s spreadsheet engine, load an Excel file, run a formula on the data it contains, and print the answer. This guide assumes you’re using Node.js and npm on a Unix-like system. We used Node.js v22.11.0 and npm v10.9.0 when writing this tutorial.
-
Create a new directory and initialise an npm project inside it:
Terminal window mkdir spreadsheet-engine-quickstartcd spreadsheet-engine-quickstartnpm init --init-type module -y -
Add the spreadsheet engine as a dependency:
Terminal window npm install @grid-is/spreadsheet-engine -
Grab a copy of our example spreadsheet. For this demo we’ll use a simple workbook that tracks monthly household expenses, categorises our spending, and lists a budget and actual spend per category. Save a local copy of
budget.xlsxalongside the project you just created. -
Now to the meat of it. Create an
index.jsfile in your project directory with this content:import { Model } from "@grid-is/spreadsheet-engine";await Model.preconditions;const model = await Model.fromXLSXFile("budget.xlsx");const totalSpent = model.runFormula("=SUM(D:D)");console.info({ totalSpent }); -
The engine’s formula evaluator is shipped as a WebAssembly module, so Node needs the
--experimental-wasm-modulesflag to load it:Terminal window node --experimental-wasm-modules index.jsYou should see the licence banner followed by the total:
{ totalSpent: 6945 }
Where to next
Section titled “Where to next”See our Tips page for more examples of loading workbooks in the browser, starting from a blank model, reading and writing cells, and exporting .xlsx files.
The API reference covers every class, method, and type the engine exposes. A few useful starting points: