Taming the Spreadsheet: How a 15-Bug LibreOffice Nightmare Sparked Our AI-Driven Office Strategy

If you have ever tried to write a native extension for LibreOffice, you already know the pain. If you haven’t, let me introduce you to the NumToWords ordeal—a project that started as a simple request to convert numbers into English words and quickly spiraled into a 15-bug debugging marathon.

We initially tried to build a standard Java-based Calc Add-in. What followed was a masterclass in silent failures: corrupted registry caches, conflicting XML manifests, and the ultimate final boss—LibreOffice’s UNO bridge secretly injecting invisible XPropertySet arguments into our methods, causing generic Err:504 parameter errors that gave zero indication of what was actually wrong.

After fighting the Java bridge to a standstill, we finally cracked the code by studying the libnumbertext repository. The solution? Scrapping pure Java for a hybrid Python UNO bridge tied to a custom compiled IDL interface (.rdb). We documented the entire brutal journey and the working solution on our wiki.

But this ordeal wasn’t just a lesson in legacy code—it was a wake-up call. Spreadsheets are the lifeblood of data work, but their extension ecosystems are stuck in the past. Moving forward, our team is launching a new strategy to modernize the spreadsheet experience, utilizing both LibreOffice and OnlyOffice to mitigate the weaknesses of each.

The Dual-Suite Strategy

We are no longer relying on a single office suite. By running LibreOffice and OnlyOffice in tandem, we get the best of both worlds: the rugged, offline extensibility of the former, and the modern, web-friendly agility of the latter.

FeatureLibreOffice StrategyOnlyOffice Strategy
Our GoalModernize the backend. Build the missing documentation and extensions to make it accessible for today’s developers.Push the limits of the frontend. Use its web-native JS macros to make it highly competitive and collaborative.
StrengthsDeep system integration, robust offline processing, powerful Python UNO bridge.Modern UI, sandboxed JavaScript environment, seamless web API integrations.
WeaknessesArchaic developer ergonomics, fragmented documentation, silent API failures.Limited access to local system resources, strict CORS and sandboxing rules.

The Vision: AI as a Native Spreadsheet Citizen

Our ultimate goal isn’t just to write better macros; it is to fundamentally change how we interact with spreadsheets using local AI, specifically Ollama.

By hooking local, open-weight language models directly into our cells (e.g., via a custom =OLLAMA() function), we are practicing the true Repatriation of Value. We are eliminating the “double-shipping penalty” that comes with cloud AI—the absurd reality of packaging our raw data, shipping it off to an external API server, and paying subscriptions or token fees just to have the processed insights shipped back. Local AI keeps the processing on the metal, where the data already lives.

Here is what we are building next to make this a reality across both suites:

  • Taming Messy Data (The Scraper’s Dream): We all know the pain of dealing with horribly formatted public data—like the notorious DOE grid data releases that resist standard scraping tools. Instead of writing brittle regex scripts, we are building tools that allow you to instruct an LLM to interpret, extract, and cleanly format unstructured text directly inside the cells.
  • Natural Language Spreadsheet Control: We are developing extensions that allow an LLM to aid in the selection, navigation, and manipulation of cells. Imagine typing a prompt to highlight all rows where grid load exceeds a certain threshold, and having the AI automatically apply the correct color and formatting rules.
  • Frictionless Macro Generation: Writing macros in LibreOffice Basic or UNO Python is a steep learning curve. We are building an LLM helper function that interprets natural language instructions and dynamically writes the required macro scripts to automate your workflow on the fly.

The NumToWords saga was painful, but it forced us to crack open the architecture of these office suites. Now that we have the blueprint, we are building the bridge.

Leave a Reply

More Articles & Posts