How to Import Microsoft Teams Presence into Excel using Graph API
Question details
The user wants to fetch live employee availability data from Microsoft Teams and display it within an Excel spreadsheet using an automation tool like VBA.

- Product
- Microsoft Excel, Microsoft Teams, Microsoft Graph API
- Device & OS
- not provided
- Scenario
- Tracking employee availability or live presence programmatically directly within an Excel spreadsheet.
- Observed behavior
- Needs a custom programmatic solution to connect Excel with Teams presence data since native Exchange data only provides basic mailbox information.
Ensure you have an active Microsoft Azure active directory account and the necessary administrative rights to grant Graph API permissions for your organization.
Use Microsoft Graph API with Excel VBA
Connect Excel to Microsoft Teams using the Graph Presence API and VBA scripts to fetch and display live employee availability.
Microsoft Exchange data generally provides mailbox information rather than live Teams presence. To get real-time availability, you must use the Microsoft Graph Presence API authenticated via Azure Active Directory.
Log into the Azure portal, register a new application, and grant it the required Microsoft Graph permissions, such as Presence.Read or Presence.Read.All.
Implement OAuth 2.0 authentication in your workflow to securely generate an access token that allows your script to connect to the Graph API.
Open your Excel workbook, press ALT + F11 to access the VBA Editor, and create a macro utilizing MSXML2.XMLHTTP to send a GET request to the Graph Presence API endpoint.
Use a JSON parser in VBA to extract the availability statuses from the API response and map the data directly into your designated Excel cells.

Looking for a Lightweight, VBA-Compatible Alternative to Excel?
While connecting Microsoft Teams presence heavily relies on the Microsoft 365 ecosystem, if you are looking for a robust, everyday spreadsheet tool that fully supports VBA and macros, try WPS Office. It is highly compatible with Microsoft Excel formats and offers a familiar interface without the heavy subscription costs.

Frequently Asked Questions
Can I use Microsoft Exchange data to get Teams presence in Excel?
No. Exchange data generally provides mailbox information (like out-of-office status) rather than live Teams presence. You must use the Microsoft Graph Presence API for real-time availability.
What API permissions are required to read Teams presence?
To read presence information for users in your organization, your application requires the 'Presence.Read.All' permission granted by an administrator in Microsoft Graph.
Can I use Python or Power Automate instead of VBA?
Yes. Microsoft Graph API can be accessed via any programming language or automation tool that supports HTTP requests, including Python, Power Automate, and Office Scripts.




