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
7 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
7 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
6 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
8 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
- September 12, 2026Word × Python · AddedDownload a .docx from OneDrive or SharePoint with Graph and read it in memory
- September 12, 2026Word × Python · AddedDiff two versions by paragraph and write a new Word report
- September 12, 2026Word × Python · AddedWrite style-check findings as Word comments on a copy of the document
- September 12, 2026Word × Python · AddedList core properties and header/footer text for a folder of .docx files
- September 12, 2026Word × Python · AddedExtract a heading outline and flag skipped heading levels
- September 12, 2026Word × Python · AddedExport Word tables to CSV without losing merged or nested cells
- September 12, 2026Word × Python · AddedScan body text and tables in document order with iter_inner_content()
- September 12, 2026Teams × Python · AddedA minimal Agents SDK bot that answers request status by ID
- September 12, 2026Teams × Python · AddedPost the open-request list to a channel through Graph (DRY_RUN by default)
- September 12, 2026Teams × Python · AddedFind channel posts with no replies using $expand=replies
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.