Turn an Excel spreadsheet into a REST API

Expose the calculations in an Excel workbook as a documented REST API, with one POST endpoint per calculation, in Rust, Java, Kotlin, C# or Go, plus typed clients and an OpenAPI spec.

A common request: "Can the website, the CRM and the mobile app all use the calculation in this spreadsheet?" Emailing the file around doesn't scale, and hosting Excel behind a server is fragile and hard to license. What you want is an API.

What Codcel generates

From one workbook, Codcel generates a REST server where each calculation becomes a POST endpoint that takes JSON in and returns JSON out:

POST /monthly_payment
Content-Type: application/json

{
  "interest_rate": 5.5,
  "loan_amount": 250000,
  "term_years": 30
}
{
  "monthly_payment": 1419.47
}

You choose the server language:

ServerFrameworkDefault port
RustAxum3030
JavaJavalin 67000
KotlinJavalin 67000
C#ASP.NET Core5000
GoGorilla Mux8080

The Rust server is the recommended option for production: it has the smallest footprint and the best performance.

Around the server

  • OpenAPI 3.0.3 spec. An open-api.json describing every endpoint and schema, ready for Swagger UI, Postman or your API gateway.
  • Typed web clients. Generated clients in TypeScript, JavaScript, Python, Java, Kotlin, C#, Go, Rust and Swift that handle the HTTP and JSON for you.
  • CORS. Enabled, so browser apps can call the API directly.
  • Localised formatting. Send an Accept-Language header to get numbers and currency formatted for that locale.
  • A full web UI, if you want one: a generated React front end connected to your API.
  • A command-line tool for scripting and batch jobs.

Steps

  1. Mark inputs and outputs in the workbook with *I* and *O* annotations, or let Codcel suggest them.
  2. Generate a server target (and a client, if you need one) in Codcel Desktop.
  3. Run the generated tests to confirm the code matches the workbook.
  4. Start the server, for example with cargo run for Rust, and call it.
  5. Deploy it like any other service: it's ordinary source code, with no Codcel runtime service involved.

Watch it

Turn Excel into a full REST API (in minutes) walks through the whole flow.

Next: the REST server reference, or download Codcel to try it.

Keep reading