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
02.12.2024
Bringing spreadsheets into the AI-first era
Introducing GRID's new mission The current wave of AI is arguably the biggest shift in user interfaces since the advent of the GUI. Meanwhile, spreadsheets remain a cornerstone of the business world — resilient, ubiquitous, and indispensable despite repeated predictions of their demise. The fusion of AI and spreadsheets is poised to be big, but it requires a fundamental rethinking — not bringing AI to traditional spreadsheets, but reimagining spreadsheets and their workflows for the AI-first era. With a unique set of cutting-edge spreadsheet technologies, GRID is uniquely positioned — and determined — to lead this transformation. AI-First The AI-first paradigm is defined by three key characteristics: Language-oriented: We interact with computers in our language, not theirs. Task-centric: Work starts with the task at hand, not the hunt for the right software. Agentic: Computers will act on our behalf, even when we’re not there. Spreadsheets Spreadsheets are not just tools; they are foundational to modern business: Ubiquitous: Over 1 billion users worldwide rely on them. Empowering: As the original low-code solution, they enable business users to solve problems independently. The fabric of business: Spreadsheets likely hold more business logic and data than any formal IT system. Bringing them together With the world’s most advanced independent spreadsheet engine — designed for lightning-fast performance and seamless compatibility with Excel and Google Sheets — and a suite of other powerful spreadsheet technologies, GRID is uniquely positioned to redefine the future of spreadsheets in an AI-first world. We’re bridging the gap between AI and spreadsheets, delivering the reliable and verifiable calculations that AI solutions currently lack. Bringing spreadsheets to ChatGPT Today, we’re taking a major step forward by expanding the Alpha testing of our ChatGPT solution and opening registrations for early access. Sign up now to secure your spot in the Alpha and see GRID’s solution in action!
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.