14. March 2025
Build a simple loan calculator API with GRID Python SDK
If you’ve spent years in the web industry, you’ve seen more trends come and go than you can count. Chances are you’ve built a loan calculator more than once, usually based on a model provided as an Excel file. While the task itself isn’t complicated, using Excel as a developer can feel unintuitive. But what if there was a way to use the power of Excel and still stay cosy inside your text editor?
This post will show you how to use the GRID API to delegate all calculations to the original spreadsheet, and even enable the client to update the formulas themselves. Our API gives you the power to access your Excel data models through an HTTP API.

Before you start
Before we get started with programming, we’ll have to create a GRID account.
Then we’ll need a spreadsheet with a loan calculation model. Don’t worry, Microsoft already has one available for download. Get it, and upload it to your GRID account. More info on uploading spreadsheets is available in our quick start guide.
Install the GRID API SDK for Python
GRID’s HTTP API is accessible using any programming language but here we are going to use our Python SDK. The SDK is available as a package on PyPI. To install it you can simply run:
More info on the SDK is available in our documentation.
We’ll be using FastAPI. I’ll not go into details on how that works but they have a great guide on their site.
The code
Just want the finished code? See https://docs.grid.is/sdk/examples/loan-calculator.
To access the API we’ll create an instance of the GRID API client and the route to use:
For the API to work you’ll need your GRID API key in the env variable GRID_API_TOKEN
. Alternatively pass it as an argument when creating the client — just make sure not to push that to Git.

Now you need the id of the spreadsheet you just uploaded. With that you’re all set to query the spreadsheet:
This will read the value of D8
in the sheet Loan calculator
, which in this case should be the monthly payment. The raw response from our API will look like this:
Looks a bit intimidating but we’re only interested in the value in the v
attribute, so let’s read it and return as JSON:
Let’s add some input parameters to control the amount, time and interests:
Here’s the interesting part: using apply
in the query allows us to set values in the Excel model and then read back the freshly calculated monthly payment value in D8
.
Note: no permanent changes are made to the Excel file itself. It remains unchanged.
Now, let’s read and return the calculated payment schedule. This is done by reading a range of cells from the model:
The rows in the payment schedule are in columns B
to H
starting at row14
, with 12 rows for each year.
This will return a payload looking something like this:
Each item in the payment_schedule
list is a row matching the calculated results in the Excel file.
Congratulations 🎉
You’ve now harnessed the power of Excel to do the heavy lifting. You’ve used formulas to calculate values within a complicated data model, all in few lines of code.
Next steps
We’ve just scratched the surface of what is possible. To find out more, read a high level overview of our API or go in depth with our technical documentation. We also have a TypeScript/JavaScript SDK if that’s more your thing.
Any questions or feedback, hit us up on [email protected]
News
Updates and announcements
26.08.2020
GRID closes $12M in Series A funding round led by NEA
We’re thrilled to announce that we have closed a $12M Series A funding round led by New Enterprise Associates (NEA), with participation from our existing investors BlueYard Capital, Slack Fund, Acequia Capital and other strategic partners! This funding will enable us to bring GRID to market and power accelerated product development. For more information see our press release. Additional coverage: Tech Crunch: GRID raises $12M Series A to turn spreadsheets into 'visual narratives' SiliconANGLE: Iceland's Grid lands $12M to help workers make their spreadsheets more visual Tech Target: Analytics startup Grid raises $12 million in funding
27.03.2019
GRID closes $3.5M seed funding
We are thrilled to share some great news with you: We just closed $3.5M in seed funding! The investment is led by BlueYard Capital, with participation from strategic investors such as Slack Fund, Acequia Capital and angel investor Charlie Songhurst. We are happy to work with this group, as they add a lot of value to our mission other than their funding. Needless to say, they deeply believe in our mission to empower people to turn any spreadsheet into a beautiful web report, dashboard or interactive application. After our private Alpha launch a few weeks ago, we are now all heads-down again working on product, strategy, network expansion and go-to-market planning. This investment - on top of our $1M angel round in October - fuels current plans well into 2021. It gives us breathing room to focus on building the initial version of our product, take it to market and grow it from there - by delighting our users. We will be adding a few people to our team in the coming weeks and months. This is a fantastic opportunity to join an exciting startup at an inflection point. Take a look at our open positions, and keep an eye on our tweets.
31.10.2018
GRID closes $1M angel round
GRID, the software company here to “free the spreadsheet,” closed a $1M angel round of funding this Monday. A Software-as-a-Service (SaaS) startup, GRID’s user-friendly software empowers people to turn any spreadsheet into a beautiful web report, dashboard or interactive application. Investors worldwide participated in the round, both institutions and private individuals from the United States, Europe and Iceland. GRID’s angel investors include: Denmark’s Futuristic.vc angel fund; Iceland’s Brunnur Ventures venture capital fund; Ari Helgason, London-based principal at Index Ventures; Iceland’s early-stage investor Investa; Anthony Deighton, CMO of Celonis and former CTO of Qlik; Kristín Pétursdóttir, Chair at Kvika bank; and America’s 1/0 Capital investment fund. “We are thrilled that the international investment community joins us in our enthusiastic mission. Tremendously humbled and grateful, we look forward to partnering with these investors to expand GRID’s network and strength,” said Hjalmar Gislason, founder and CEO of GRID. “This funding will give us the runway we need to build the initial commercial version of the GRID product and fuel our go-to-market initiatives.” GRID’s founding team includes both repeat team members and Silicon Valley expertise, bringing together the strength of legacy teamwork with U.S.-based go-to-market experience. The founding team consists of: Hjalmar Gislason CEO and founder; Laura Edwards, VP of Revenue; Thorsteinn Yngvi Gudmundsson, VP of Operations; Borgar Thorsteinsson, lead client developer; and Steinn Eldjarn Sigurdarson lead cloud and server developer.