If you’re decent in Python (or aspire to be) but don’t have the chops for advanced data work in Excel, Microsoft now offers the kind of peanut butter-and-chocolate combination that you may consider a gift. At least until it goes behind the paywall.
Microsoft’s Stefan Kinnestrand, writing about “the best of both worlds for data analysis and visualization,” writes that this public preview of Python in Excel will allow spreadsheet tinkerers to “manipulate and explore data in Excel using Python plots and libraries and then use Excel’s formulas, charts, and PivotTables to further refine your insights.”
Microsoft partnered with Python analytics repository Anaconda to bring libraries like Pandas, Statsmodels, and Matplotlib into Excel. Python in Excel runs on Microsoft’s cloud servers, and the company is touting the security that should offer. Python runs in isolated containers, with no access to devices, your network, or user tokens, Microsoft states. Python and Excel can only really talk to each other through limited functions—xl() and =PY()—that can only return code results, not macros, VBA code, or other data, Microsoft claims.
If you want to immediately start getting in way over your head in two different languages at once, you’ll need to be in Microsoft’s 365 Insider Program on the beta channel and have Excel updated to build 16818. Select “Formulas” from the ribbon bar, choose “Insert Python,” then click “Try preview.” Anaconda has a series of blog posts and videos walking through introductory examples and exercises on Python-in-Excel (PyCel?) coding.
Right now, Python in Excel is included with a Microsoft 365 subscription but may require a paid license at some point before general availability, according to Microsoft.
It will be interesting to see how Python’s integration into Excel works out. It’s a very specialized, cloud-hosted, and seemingly containerized and secured code offering. But Office apps’ history with Visual Basic for Applications (VBA) scripts and macros has a long history of exploits, patches, and more exploits. Early last year, Microsoft all but banned downloaded macros in Office unless someone goes out of their way to get infected. Barring that, it’s an intriguing expansion of a code environment that is already Turing complete.
Listing image by Pavlina Popovska / Getty Images