We re-wrote the Excel engine in Rust to run headless for agents

peterjliu3 pts0 comments

Peter J. Liu on X: "With AI we re-wrote the Excel engine in Rust to run headless for agents, deployed in Compound to the world’s top investment firms.

Our Excel engine in some cases 100x faster and near 100% fidelity with Excel (much better than LibreOffice).

This is how we did it. https://t.co/HZHmsMbS0a" / X<br>Post

Log inSign up

Post

Peter J. Liu

@peterjliu

With AI we re-wrote the Excel engine in Rust to run headless for agents, deployed in Compound to the world’s top investment firms.

Our Excel engine in some cases 100x faster and near 100% fidelity with Excel (much better than LibreOffice).

This is how we did it.

span:not(:empty)~span:not(:empty)]:before:content-['·'] [&>span:not(:empty)~span:not(:empty)]:before:px-1 [&>span:not(:empty)~span:not(:empty)]:before:shrink-0">3:19 PM · Aug 3, 2026292Views

span:not(:empty)~span:not(:empty)]:before:content-['·'] [&>span:not(:empty)~span:not(:empty)]:before:px-1 [&>span:not(:empty)~span:not(:empty)]:before:shrink-0 min-w-0 overflow-hidden">Peter J. Liu

@peterjliu

25m

Excel is used by billions of humans to work synchronously through a UI. But for agents to be maximally productive, it’s better to run programs headless via API.

Excel has been optimized over decades (written in C++) yet some of our customers have huge workbooks with hundreds of Show more

svg]:size-5 text-body hover:bg-mix-current hover:bg-mix-amount-10 active:bg-mix-current active:bg-mix-amount-15 focus-visible:bg-mix-current focus-visible:bg-mix-amount-10 outline-current -m-2 shrink-0 cursor-pointer border-transparent p-0 text-body size-9 [&>svg]:size-[1.25em] [&>[data-engagement-icon]]:size-[1.25em] group-hover:bg-mix-current group-hover:bg-mix-amount-10" aria-label="View count" type="button" data-state="closed" href="/peterjliu/status/2084298240242098648/quotes">45

span:not(:empty)~span:not(:empty)]:before:content-['·'] [&>span:not(:empty)~span:not(:empty)]:before:px-1 [&>span:not(:empty)~span:not(:empty)]:before:shrink-0 min-w-0 overflow-hidden">Peter J. Liu

@peterjliu

25m

Nothing else like our engine exists.

Google Sheets and LibreOffice have missing important functions (e.g. many dynamic arrays) or have significant discrepancies at the edges that are deal-breakers for our discerning, high-finance customers. A wrong value in a cell can have Show more

svg]:size-5 text-body hover:bg-mix-current hover:bg-mix-amount-10 active:bg-mix-current active:bg-mix-amount-15 focus-visible:bg-mix-current focus-visible:bg-mix-amount-10 outline-current -m-2 shrink-0 cursor-pointer border-transparent p-0 text-body size-9 [&>svg]:size-[1.25em] [&>[data-engagement-icon]]:size-[1.25em] group-hover:bg-mix-current group-hover:bg-mix-amount-10" aria-label="View count" type="button" data-state="closed" href="/peterjliu/status/2084298242175664434/quotes">42

span:not(:empty)~span:not(:empty)]:before:content-['·'] [&>span:not(:empty)~span:not(:empty)]:before:px-1 [&>span:not(:empty)~span:not(:empty)]:before:shrink-0 min-w-0 overflow-hidden">Peter J. Liu

@peterjliu

25m

We started by looking at IronCalc, an open-source Rust Excel engine, but quickly realized it was missing tons of features and was pretty slow. We used multiple agentic loops (wrote over 800k lines of Rust) to hill-climb well-defined objectives:

1. Match Excel values over Show more

svg]:size-5 text-body hover:bg-mix-current hover:bg-mix-amount-10 active:bg-mix-current active:bg-mix-amount-15 focus-visible:bg-mix-current focus-visible:bg-mix-amount-10 outline-current -m-2 shrink-0 cursor-pointer border-transparent p-0 text-body size-9 [&>svg]:size-[1.25em] [&>[data-engagement-icon]]:size-[1.25em] group-hover:bg-mix-current group-hover:bg-mix-amount-10" aria-label="View count" type="button" data-state="closed" href="/peterjliu/status/2084298245958967760/quotes">88

span:not(:empty)~span:not(:empty)]:before:content-['·'] [&>span:not(:empty)~span:not(:empty)]:before:px-1 [&>span:not(:empty)~span:not(:empty)]:before:shrink-0 min-w-0 overflow-hidden">Peter J. Liu

@peterjliu

25m

Most Excel Agents (e.g. Claude in Excel) are either implemented as Add-ins to side-step the need to implement an Excel engine, but require Excel to be open.

With our headless engine, Compound users don’t suffer from this limitation and can work on countless Workbooks in Show more

svg]:size-5 text-body hover:bg-mix-current hover:bg-mix-amount-10 active:bg-mix-current active:bg-mix-amount-15 focus-visible:bg-mix-current focus-visible:bg-mix-amount-10 outline-current -m-2 shrink-0 cursor-pointer border-transparent p-0 text-body size-9 [&>svg]:size-[1.25em] [&>[data-engagement-icon]]:size-[1.25em] group-hover:bg-mix-current group-hover:bg-mix-amount-10" aria-label="View count" type="button" data-state="closed" href="/peterjliu/status/2084298248873816142/quotes">65

Log in or sign up for X<br>See what’s happening and join the conversation<br>Continue with phoneContinue with AppleContinue with Google<br>or<br>Log in with username or email

Relevant people

Peter J....

span empty current size hover amount

Related Articles