What the advanced edition covers
- Every tip includes code, an API or automation. Anything that only needs screen operations belongs to the practical edition, and this edition links to the matching practical tip instead.
- Code was run with a local Python and the output is shown. Code that needs a Microsoft 365 sign-in was run up to the sign-in step, which confirms that the SDK calls it uses exist.
- No secrets appear in code; tenant IDs and similar values are read from environment variables. Code that writes or sends anything does nothing by default (DRY_RUN).
- Code that uses Microsoft Graph names the smallest permissions it needs.
Reading order
- End-to-end manual (one example from idea to operation)
- Computational thinking (decompose, abstract, verify)
- From instructions to code (how to ask Copilot for code)
- Choosing where code runs
- Authentication, permissions and governance
- Apps × Python pages (start with the app you use)
- Workflow recipes and document search (combined examples)
Prerequisites
- Python 3 available locally. Install libraries in a per-project virtual environment (venv).
- A Microsoft 365 work or school account.
- For code that uses Microsoft Graph, an app registered in Microsoft Entra by your organization's admins, with consent to the permissions it needs. Do not widen permissions on your own.
- Python in Excel is subject to its availability and licensing terms (see the Excel × Python page).
Apps × Python
Excel × Python
Running pandas from cells with =PY() and xl(), and when to use openpyxl locally instead
7 tipsWord × Python
Extracting paragraphs and tables with python-docx and writing results to a separate file
7 tipsPowerPoint × Python
Reading slide text, tables and notes in bulk with python-pptx
7 tipsOutlook × Python
Reading and tallying mail and calendar events with Microsoft Graph
9 tipsTeams × Python
Posting through Workflows, reading messages with Graph, and bots
8 tipsSharePoint / OneDrive × Python
Reading drives, lists and column values with Graph, and tracking only changes
10 tipsDocument Search × Python
Searching large document collections by meaning, not just matching words
8 tipsAgents × Python
Adding Python logic to Copilot Studio and Agents SDK agents
6 tipsCode Execution in Copilot
Where Copilot writes and runs code, and how to check the result
9 tipsPower Automate × Python
Where Python fits into flows (desktop and Azure Functions)
How this page is made:
End-to-End Manual
One worked example, checking wording in Word documents, from idea to maintenance
8 sectionsComputational Thinking
Decomposition, abstraction, pattern recognition, algorithm design and verification, step by step on a real task
6 tipsFrom Instructions to Code
Instruction patterns for getting Copilot and GitHub Copilot to write code
6 tipsChoosing Where Code Runs
Python in Excel, a local venv, Azure Functions and notebooks
10 tipsAuthentication, Permissions and Governance
MSAL sign-in, least privilege, secrets, personal data and audit trails
5 tipsWorkflow Recipes
Wording checks, batch slide checks, ledger tallies, request-mail tallies and library column audits
Recently added or updated
- October 30, 2026Power Automate × Python · AddedDraft a Run Python script with Copilot natural language to script (preview)
- October 29, 2026Teams × Python · AddedCheck the 28 KB limit before posting to a Workflows webhook and back off when throttled
- October 9, 2026SharePoint / OneDrive × Python · RevisedFetch thumbnails in one Graph request with a bearer token, no redirect
- October 9, 2026Authentication, Permissions and Governance · AddedSend a SharePoint Online token with every upload-session chunk
- October 9, 2026Power Automate × Python · AddedWrite a @workflow_tool for Azure Functions Hosted Skills workflows
- October 7, 2026Power Automate × Python · AddedCall an Agent from a Durable Functions orchestrator with context.call_agent
- October 7, 2026Agents × Python · AddedAdd an Agent to a Python Azure Function with the markdown_agent binding
- October 2, 2026Teams × Python · AddedReceive attachments with the downloaders and read them from input_files
- October 2, 2026Authentication, Permissions and Governance · AddedLog request_id to trace one request end to end
- September 12, 2026Word × Python · AddedDownload a .docx from OneDrive or SharePoint with Graph and read it in memory
How this section is made
Sources are official Microsoft documentation (learn.microsoft.com, support.microsoft.com), the Microsoft 365 Developer Blog, the Microsoft Graph changelog, and the official documentation and GitHub release notes of each library. Search-engine result pages are not used.
New information is collected automatically every day and turned into candidate tips. A machine check confirms that the supporting passage exists in the source, that numbers appear in the source, that the tip does not overlap the practical edition, that the code holds no secrets or default writes, that Graph permissions are minimal and named, and that the code's API names appear in the source. Only candidates that pass are published. Code in automatically collected candidates is never run on the server.
This section is not official product documentation. Try code on a small amount of data first, within your organization's rules and permissions.