When attempting to enter a =PY() formula or initialize Python in Excel on an enterprise computer, users often encounter an alert stating: Python is disabled or Your organization has disabled Python in Excel. This security block is not a software crash or an installation bug. It indicates that your company’s Microsoft 365 tenant administrators have enforced a security policy that restricts the execution of cloud-based Python runtimes.
Because Python in Excel transmits data to isolated Azure containers for execution, enterprise IT teams frequently block the feature until security reviews, privacy audits, and administrative configurations are approved.
Quick Fix: Resolve “Python is Disabled” Policy Blocks
To remove the block, a Microsoft 365 administrator must enable the “Python in Excel” policy setting within the Microsoft 365 Apps admin center (Cloud Policy Service) or set the Group Policy object Allow Python in Excel to Enabled. On the user side, ensure that Connected Experiences are enabled under File > Options > Trust Center > Trust Center Settings > Privacy Options.
Why Corporate IT Policies Disable Python in Excel
Corporate network environments operate under strict zero-trust and data-loss-prevention (DLP) frameworks. Python in Excel runs inside dedicated hypervisor containers managed by Microsoft in Azure, not locally on the endpoint workstation. Because referenced cell ranges leave the corporate boundary over secure HTTPS connections, security policies frequently disable the feature by default:
- Cloud Policy Service Enforcement: Enterprise administrators manage Office features globally using the Microsoft 365 Apps admin center. If the tenant baseline disables preview features or unapproved cloud-backed services, the
=PY()engine is blocked before an initialization call can leave Excel. - Local and Domain Group Policy (GPO): Active Directory GPOs pushed to corporate laptops can explicitly block external scripting runtimes or disable connected Office services via registry keys.
- Disabled Connected Experiences: Python in Excel relies on Microsoft’s “Connected Experiences” infrastructure. If privacy policies disable experiences that analyze content, Excel cannot transmit data frames to the cloud runtime.
- Tenant License and Security Profiles: Python in Excel requires an active commercial or enterprise Microsoft 365 license. If your user profile lacks the necessary entitlement or is assigned to a restricted tenant group, access is revoked at the licensing layer.
For related subscription and entitlement issues, review Solving “Subscription Required”: Why Python in Excel is disabled in your tenant..
Diagnostic Workflow: Identifying the Specific Policy Mechanism
Before contacting enterprise IT, determine whether the restriction stems from your workstation settings, a Group Policy, or a global tenant configuration:
[User Enters =PY()]
│
▼
[Displays "Python is disabled"]
│
├── Check Trust Center: Privacy Options
│ └── Connected Experiences Unchecked ──► Enable locally (User Fix)
│
├── Check Windows Registry Policy Path
│ └── "pythoninexcelenabled" = 0 ───────► Domain GPO Enforcement
│
└── Check M365 Apps Admin Center
└── Cloud Policy Profile Enforced ────► Tenant Admin Remediation
Step 1: Check Trust Center Privacy Settings
- Open Excel and click File > Options.
- Select Trust Center, then click the Trust Center Settings… button.
- Select Privacy Options, then click Privacy Settings….
- Scroll down to Connected experiences.
- Check if Turn on experiences that analyze your content is checked or grayed out.
- If it is unchecked and editable, checking it and restarting Excel may restore access immediately.
- If the option is grayed out with a message stating These settings are managed by your administrator, the block is controlled higher up by group policy.
Step 2: Check the Windows Registry for GPO Restrictions
Press Windows Key + R, type regedit, and press Enter. Navigate to the following policy keys:HKEY_CURRENT_USER\Software\Policies\Microsoft\Office\16.0\excel\securityHKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Office\16.0\excel\security
Inspect the values in the right-hand pane:
- If a DWORD named
pythoninexcelenabledexists and is set to0, domain group policy has explicitly locked Python off. - If
disconnectedmodeorpreventconnectedexperiencesis set to1or2, cloud-backed analysis is banned across the entire Office suite.
If script execution policies are enforced through PowerShell or enterprise execution levels, see Fixing “Script execution is disabled” by Organizational Group Policy (GPO)..
Step-by-Step Remediation for Administrators and Users
Method 1: Enabling Python via Microsoft 365 Cloud Policy (For Administrators)
In modern corporate environments using Microsoft Intune or Microsoft 365 Apps admin center, policies are managed through the cloud without classic domain GPOs:
- Sign in to the Microsoft 365 Apps admin center (
config.office.com) using tenant admin credentials. - Under the Customization menu, select Policy Management.
- Edit the existing configuration profile assigned to your end-users (or create a new profile targeted at analysts).
- In the policies search box, search for: Python in Excel.
- Locate the policy titled: Allow the use of Python in Excel.
- Set the policy configuration to Enabled.
- Save the profile changes. Policies deploy automatically to connected endpoints during their next M365 check-in cycle (typically within 90 minutes).
Method 2: Adjusting Group Policy Objects (GPO)
If your enterprise uses local Active Directory Domain Services:
- Open the Group Policy Management Console (
gpmc.msc) on a Domain Controller. - Navigate to your targeted Organizational Unit (OU) policy.
- Go to User Configuration > Administrative Templates > Microsoft Excel 2016 > Excel Options > Security.
- Locate the setting Allow the use of Python in Excel.
- Change the configuration from Disabled or Not Configured to Enabled.
- On the user’s workstation, force a policy refresh by opening Command Prompt and running:
gpupdate /force - Restart Excel completely.
Method 3: Restoring Connected Experiences
If tenant policies permit cloud computation, but your user account has disabled connected experiences:
- Open Excel and click File > Account.
- Under Account Privacy, click Manage Settings.
- Under Connected Experiences, ensure the following boxes are checked:
- Turn on experiences that analyze your content (required for sending data to the Azure container).
- Turn on all connected experiences (required for cloud session orchestration).
- Click OK, close all instances of Excel, and relaunch the application.
If your network utilizes security barriers that block data movement between private tables and external APIs, consult Handling “Data Privacy Levels” that block Python from accessing external data..
Security Architecture Facts for IT Review
If your corporate IT security team hesitates to approve Python in Excel, provide them with these architectural facts from Microsoft’s enterprise compliance documentation:
- Ephemeral Containers: Code does not run on internal corporate endpoints. Each session executes inside an isolated, stateless Microsoft Azure container running an Anaconda distribution.
- No Network Egress from the Container: The cloud container cannot access internal company local area networks (LANs), nor can it initiate outbound calls to public internet APIs. Python
requests,urllib, or external network socket operations are restricted by cloud hypervisor firewalls. - Data Isolation: Containers are single-tenant and destroyed when execution finishes. Data is never retained for machine learning model training or persistent cloud storage.
- Protected View Integration: Python will not run in files opened from untrusted sources, public websites, or external email attachments until the user explicitly leaves Protected View. For operational troubleshooting on document isolation, review Troubleshooting “Safe Mode” limitations: Why Python won’t run in protected view..
Once the administrative policy is updated, test access by entering =PY("1+1") in a blank workbook. If policy restrictions are lifted but the cell still fails to evaluate, review Troubleshooting “Firewall Blocks” preventing the Python container handshake..