The Spreadsheet Parsing Problem
You are looking for the reason why your Excel parser returns different results than the workbook itself. The business team has updated their model and added logic your code does not know. Your code is now wrong, and nobody was told.
The Hidden Cost of Spreadsheet Parsing
1. A Parser Reads Values, It Does Not Calculate
// What we write
const workbook = XLSX.readFile('pricing.xlsx');
const price = workbook.Sheets['Quote']['B15'].v;
// What we get: the value that was stored when the file was last saved.
// Change an input, and nothing is recalculated:
// - formulas that reference other cells
// - lookups into other sheets
// - defined namesTo get a new result for new inputs, your code has to recalculate the formulas itself. That means rebuilding them.
2. The Maintenance Burden
- Every formula that matters is rebuilt in code.
- Every change in the workbook has to be made a second time.
- Differences show up late, usually when a customer notices a wrong number.
The API Approach
Instead of parsing the file, let the workbook calculate:
const url =
'https://spreadapi.io/api/v1/services/{serviceId}/execute?flatten=true';
const response = await fetch(url, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
inputs: { quantity: 100, customerType: 'enterprise' }
})
});
const data = await response.json();
const price = data.result.finalPrice;With SpreadAPI you import the workbook once, choose which cells are inputs and which are outputs, and publish it as a service. Each call sets the inputs, calculates the workbook on the server and returns the outputs.
Why Developers Switch
1. No Parsing
Your integration is one HTTP call. There is no file handling and no formula code on your side.
2. Business Logic Stays in Excel
- The business team changes the pricing in Excel.
- Somebody imports the new workbook into the service and publishes it. Inputs, outputs and tokens are kept.
- From the next call on, every caller gets the new logic. No code release is needed.
3. The Workbook Is Not Handed Out
Callers send inputs and get outputs. They do not see the workbook or its formulas. A service is public, or protected by tokens you create and revoke. See Tokens and access.
Technical Implementation
How It Works
- Import: the Excel workbook, in the browser
- Define: input and output cells
- Publish: the service gets its address
- Call: GET or POST, JSON back
Example: Loan Calculator
const url = 'https://spreadapi.io/api/v1/services/{serviceId}/execute';
const response = await fetch(url, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
inputs: { principal: 500000, rate: 0.045, years: 30 }
})
});
const data = await response.json();
// {
// "service": { ... },
// "inputs": [ { "name": "principal", "value": 500000 }, ... ],
// "outputs": [
// { "name": "monthlyPayment", "title": "Monthly payment",
// "value": 2533.43 }
// ],
// "metadata": { "executionTime": 12, "totalTime": 15, ... }
// }outputs is a list. Find an entry by its name, or add flatten=true to the address and read result.monthlyPayment. Percentages are sent as decimals: 0.045 for 4.5%. The details are in Call a service over the API and The API response.
What About Response Time?
We measured our public demo quote calculator, a workbook with four sheets: a calculation took about 20 ms on the server, and the whole round trip from a client in Germany had a median of 97 ms. The first call after a pause took 213 ms. These numbers hold for that workbook only. Method and details: Excel API response time.
Code Examples
A Helper
async function calculate(serviceId, inputs, token) {
const url =
`https://spreadapi.io/api/v1/services/${serviceId}/execute?flatten=true`;
const headers = { 'Content-Type': 'application/json' };
if (token) headers.Authorization = `Bearer ${token}`;
const response = await fetch(url, {
method: 'POST',
headers,
body: JSON.stringify({ inputs })
});
const data = await response.json();
if (!response.ok) throw new Error(data.message || data.error);
return data.result;
}Dynamic Pricing
app.post('/api/quote', async (req, res) => {
try {
const quote = await calculate(
PRICING_SERVICE_ID, req.body, process.env.SPREADAPI_TOKEN
);
res.json(quote);
} catch (error) {
res.status(400).json({ error: error.message });
}
});Keep the token on your server. Do not put it into code that runs in a visitor's browser.
Several Scenarios in One Request
const response = await fetch('https://spreadapi.io/d/{serviceId}', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
action: 'batch',
scenarios: [
{ label: '4.0%', inputs: { principal: 500000, rate: 0.04, years: 30 } },
{ label: '4.5%', inputs: { principal: 500000, rate: 0.045, years: 30 } },
{ label: '5.0%', inputs: { principal: 500000, rate: 0.05, years: 30 } }
]
})
});
const { scenarios } = await response.json();
// one entry per scenario, each with label, success and outputsThis is the batch action of a service's discovery address. It takes 2 to 20 scenarios, and every calculated scenario counts as one call. See The discovery address.
AI Assistants
For Claude and ChatGPT you write no code. Every published service has an MCP address, and an assistant connected to your account at https://spreadapi.io/mcp reaches the services you allow. See Excel MCP server.
Migration Guide
Step 1: Find the Excel Files Your Code Depends On
git grep -n -i -E 'xlsx|readFile|workbook'Step 2: Publish Each Workbook
- Import the Excel file into SpreadAPI
- Choose the input cells
- Choose the output cells
- Test with values whose results you know, then publish
Step 3: Replace the Parser Code
// Before: parser plus rebuilt formulas
function calculatePrice(data) {
const workbook = parseExcel('pricing.xlsx');
// rebuilt formulas
return price;
}
// After: one call
async function calculatePrice(data) {
const result = await calculate(PRICING_SERVICE_ID, data);
return result.price;
}What It Does Not Do
- VBA macros do not run, and links to other workbooks are not followed.
- A service does not take an arbitrary uploaded file per call. A workbook is imported once and published; callers send input values.
- There is no version history of a service. Callers get the published version until you publish again.
- An input is a single value: a number, a text or yes/no. An output can be a single cell or a cell range.
Common Questions
"Is my logic exposed?"
No. Callers see the inputs and outputs you defined and the results of their own calls. One setting changes that: with Allow Excel export on, callers can download the filled-in workbook, formulas included. Leave it off when the logic is confidential.
"What if the Excel workbook has errors?"
Then the API returns what the workbook calculates. You fix the error once, in the workbook.
"What does it cost?"
The Basic plan is free: one published service and 1,000 calls a month. Pro costs €99 a month, with unlimited published services and 10,000 calls a month. See Pricing.
Getting Started
- Pick the Excel integration that causes the most trouble
- Sign up for SpreadAPI
- Import the workbook and choose inputs and outputs
- Publish and make your first call
Questions? Contact support@airrange.io