When a =PY() cell calculates, Excel sends the code and the relevant Excel data to Microsoft's cloud, runs it in a sandboxed Python environment, and sends the result back. Your laptop does almost nothing — most of the work happens on Microsoft Azure.
Microsoft pre-installs a curated set of libraries: pandas, NumPy, matplotlib, seaborn, scikit-learn, statsmodels, and a few more. You can't pip install something extra into a =PY() cell — what's there is what's there.
=PY(). Use a Jupyter notebook for that.xl(...).Python cells are calculated after regular Excel formulas, top-to-bottom, left-to-right by default. If you have one =PY() that depends on another, that's fine — Excel orders them correctly.
The data in cells referenced by xl(...) is sent to Microsoft's servers. For most spreadsheet work this is fine; for highly sensitive data, check your organisation's policy. The data is not used to train AI models per Microsoft's published policy at launch — but verify the current policy at support.microsoft.com.
At launch, basic =PY() usage is included in Microsoft 365. Premium tiers offer faster compute and higher data limits. Check Microsoft's pricing page for the current numbers.
=PY() is a network round-trip. Hundreds of them in one workbook will feel slow.=PY() runs in Microsoft's cloud — your data goes through their servers.=PY().Which of these should live in =PY(), and which in a Jupyter script?