Building a Real-Time Collaborative Spreadsheet Backend

A real-time collaborative spreadsheet looks like a WebSocket and a broadcast. Relaying edits between browsers is the small part. Ordering, structure changes, formulas on the server, persistence and reconnection are the work that follows.

icon jspreadsheet

Published on October 5, 2026

What a collaborative spreadsheet needs

Your users want to work on spreadsheets together, inside your product, with their data in your database. You already have a data grid, and the remaining work looks small.

This post lists the remaining work, part by part, so the build-or-buy decision is made with the full scope in view.

The pieces of a collaborative spreadsheet backend

First week: a working demo

A WebSocket server relays each edit to the other users of the document, and a timer saves the document to the database. Two browser windows open the same document; a change in one appears in the other. The demo works.

What comes after the demo

Ordering. When two users edit at the same moment, each client applies its own change first. Without a single authority that decides the order of operations, the two screens stop agreeing, and nothing reports it.

Structure. Inserting a row is not a cell edit. Every reference below it moves, formulas are rewritten, and merges and styles shift. A concurrent insert from another user has to land in the same place on every screen.

Formulas on the server. A server that relays messages does not know that D7 is =SUM(D2:D6). When your backend or an AI asks for the total, something has to compute it, which means running the spreadsheet engine on the server with the same results as the browser.

Persistence. Saving the full document on every change is simple and stops scaling as documents grow. Saving operations instead means mapping every spreadsheet method to an update of your storage, and keeping that mapping correct as features are added.

Reconnection. A laptop sleeps for an hour. When it wakes, the client has to find out what it missed and catch up without corrupting the document.

Everything around it. Permissions per document, sharing and invitations, an API for other systems, images stored outside the document, snapshots, comments. None of this is the spreadsheet, and the feature does not ship without it.

AI. Users expect an assistant that works on their data. That means a model integration, tools that change the document safely, conversations, attachments, and budgets so one user cannot spend the month's credits.

What Jspreadsheet Server covers

Jspreadsheet Server is a set of Node.js packages that covers the parts above and leaves you the decisions that belong to your product:

Concern Provided Yours
Ordering and conflicts A sequencer per document, last-write-wins at cell level, convergence by replaying the same sequence None
The live document The Jspreadsheet engine, headless, with 500+ functions None
Persistence Per-operation adapters for MongoDB, PostgreSQL and Redis The database, or five handlers for another
Identity Three hooks that receive each request's token Your login and your rules
Integration A REST API over every worksheet module Your jobs
AI An agent with spreadsheet tools, an MCP server, a PROMPT formula The model, the budget
Scale Partitioning by document, no coordination layer Your infrastructure

The full list, with links to each part, is in Why Jspreadsheet Server.

What stays yours

The usual concern with buying is control. These parts stay in your hands:

  • Documents are stored in your database, through an adapter.
  • The server has no user table. Your hooks decide every request.
  • It runs where you deploy it, including networks with no internet access.
  • AI keys live in your server configuration, and you choose the model.

When to build and when to buy

Building makes sense when collaboration is the core of your product and you will staff it for years. If spreadsheets are a capability your product needs, buying puts those months into your product instead.

To see the result, open the Intrasheets demo in two windows, or run the reference application on your machine with Docker.

Useful links

Why Jspreadsheet Server
Use cases
Getting started