Python Comes to Google Sheets
Indeed, it is “Not a way to script a spreadsheet or an API that allows a Python program to interact with a spreadsheet, but the full power of Python because the spreadsheet is in Python,” he said in a Neptyne blog post introducing the Google Sheets add-on.
“We always wanted to make programming more accessible to non-programmers, and spreadsheets are a great way to do that; it is how people already interact with data — the universal data canvas if you will,” Osinga told The New Stack.
Call for Python
Although the Neptyne spreadsheet saw good traction, many users wanted to be able to use the power of Python inside the spreadsheet they were already using.
“Then when Microsoft came out with their Python integration, we saw that as a moment to launch the same for Google Sheets. Because we already had the infrastructure, that took us about a month or so to build,” Osinga said.
However, it took the team about 20 months to develop the core Neptyne standalone spreadsheet.
Osinga explained that a large fraction of internal tools in companies are spreadsheets, and most start out as spreadsheets. By adding Python capabilities these internal tools can become a lot more powerful, he said.
“You see Python being used a lot already in these sorts of solutions, but as standalone scripts that are hard to deploy and use,” Osinga said. “All very ‘duct-tape-y’ but that’s how a lot of systems work. With Neptyne and Google Sheets we get to systems that are easier to use, maintain and deploy and where end users can make changes to the tool in the spreadsheet without having to know Python (but they can still write spreadsheet formulas to call the Python). And of course with ChatGPT for people that know a little Python, it is a lot easier to get going these days.”
The Neptyne add-on enables developers to write code using the built-in editor and to use any third-party libraries.
Yet not everyone wants to use a built-in editor. “I’d like the ability to use a standard editor like VS Code instead of the built-in one,” said Andrew Brust, CEO of Blue Badge Insights, who gave a product a quick whirl. “I didn’t see any integration with Git-based CI/CD systems or any built-in version control, which is something that would limit the tool’s enterprise readiness. Either that should be added or, if it’s there and I didn’t see it, it should be made more discoverable.”
Brust also noted that functions seemed to evaluate slowly in his case. However, “It installs really easily (especially since everything’s in the cloud) and the tutorials and sample apps were really helpful in getting productive quickly. Editing code in a sidebar is unwieldy but the full-screen option is helpful, as is the syntax completion and source code color formatting in the browser-based editor.”
Python for Sheets enables developers to extend the functionality of spreadsheets by writing their own Python functions in an integrated editor and REPL,” Osinga said in the blog post.
“With the power of Python, you can easily import data from the web, implement your own custom formulas, and leverage the power of the vast ecosystem of Python packages,” he also said.
For the Numbers People
Moreover, the Neptyne for Google Sheets add-on also allows Python functions to be used as spreadsheet functions; cell ranges to be used as Python lists, and DataFrames to be visualized in either a package like Matplotlib or in Google Sheets’ built-in chart types, Brust noted.
It Just Makes Sense
“This new add-on will bring seamless Python integration to Google Sheets,” Osinga told The New Stack. “This includes the ability to install third-party packages, make API calls to any endpoint and return complex data structures such as Panda DataFrames back to sheets.”
Integrating Python with spreadsheet applications just makes sense,” Brust said. “The Pandas DataFrame structures that are commonly used in Python for data querying, analysis and machine learning bear a strong resemblance to individual workbook tabs or even 2D cell ranges. It’s all about rows and columns. Going beyond a scripting language to a popular data-savvy language with a huge ecosystem like Python’s is a big win for Google Sheets shops.”
Google Sheets has an extensive set of functions — or formulas in Google’s parlance — but it doesn’t come close to what Python offers for data processing, Osinga said.
“Pandas is the go-to tool for data scientists and the Neptyne add-on comes with an easy way to go from and to DataFrames — if you have a Python function that returns a DataFrame containing the latest sales, you can put [the formula] B1=Py(“get_sales_data”, C1) and it will ‘spill‘ the data in the cells from B1 on,” he said.
The product leverages NumPy for numeric processing and offers financial functions and forecasting. And users can import and use libraries from OpenAI, Anthropic or Hugging Face and use AI that way straight from their spreadsheet. The company created a brief video explaining this.
The key features of Python for Sheets include the ability to call any internet-accessible API — a capability that Microsoft’s Excel Python solution does not offer, Osinga said. In addition, developers can install any PyPi package and the “spilling” enables developers to easily use Python outputs directly in the spreadsheet — not just DataFrames but also lists, dictionaries and NumPy arrays.
Automation Is Critical
“Automation is critical for expert spreadsheet users…,” said Farzad “Fuzzy” Khosrowshahi, vice president of product engineering at Slack and also one of the first engineers to work on building what became Google Sheets at 2Web Technologies, which Google acquired in 2006. “Of all the apps I know (Docs, Slides, etc.), the one where automation is a must is spreadsheets. This is why when we started Google Sheets, we knew we had to provide some sort of automation for our users and hence we added Google Apps Scripts very soon after the launch of Google Sheets.”
Moreover, being able to manipulate spreadsheets via code is critical and has always been the case, Fuzzy said.
He also noted that automation of spreadsheets via Python fills a void, as there are more than 8 million Python developers in the world. “It’s one of the most popular languages in the world both at work and especially in school. I actually remember some of my former colleagues bemoaning the fact that they could not leverage Python easily with Sheets.”
Neptyne pricing has three tiers. The free tier is for individuals who just want to try it out for a small product. The pro version is for individuals who need more compute and direct support. The teams tier is for teams where a few people might be writing Python but anybody in the organization wants to be able to use the spreadsheets. That last tier comes with a fair use policy — if you need large amounts of processing power Neptyne will provide a custom contract.
At launch the product is free for everybody — the three tiers are for the company’s current product and the Sheets Extension will fold into that. But there always be a free version.
“As a third-party offering, customers may incur risks with Neptyne (compared to, say, Microsoft’s first-party Python integration with Excel — currently in preview) and will incur additional monthly fees beyond the Starter level,” Brust asserted.
Meanwhile, Lars Rasmussen, an investor in Neptyne, told The New Stack he is not really a Python developer, “But as an investor, it’s hard to miss how important Python has become for AI and data science. A lot of data analysis that used to be done in spreadsheets is now done by data scientists in Python. If Python in Google Sheets can bridge this gap that would be an obvious win IMHO. And AI of course makes it easier than ever to write Python code for people that aren’t great in doing that as you can see from the amazing AI assistant the team built.”
Rasmussen is the co-founder of Google Maps. He also was the director of engineering for Facebook in London. In 2003, Lars and his brother Jens co-founded a mapping-related startup, Where 2 Technologies, which was acquired by Google in October 2004. Rasmussen became the head of the Google Maps team and worked at Google until joining Facebook in late 2010. He is now a self-employed angel investor.