This article is going to explain how to create a function app on Azure and use Excel API in Microsoft Graph. It shows how to use MS Graph explorer and postman to call function endpoints in Excel API. A demo project is explained how to process an existing excel file, Add a new row to a excel sheet, Calculate total in excel columns, Create a column and pie chart based on excel data.
↑Return to Top
You should have a Microsoft account to use Microsoft Graph. You can query on top of the data available in MS Graph as your emails, OneDrive files, Calendar events, Tasks etc. At first let's try to get your profile information.
We can access to all these Office 365 products through a single REST endpoint and manage millions of data in Microsoft Cloud, Let's see how we can view profile information of your Office 365 account using Graph explorer
Let's login to your office 365 account and view your profile information,
You can see available OAuth 2.0 tokens as below, for our application let's try to get a new access token. Click on Get New Access Token button
Let's try to register a new application, Click on Add an app, you can see a screen like this, specify the application name as sldevforum and click on Create button
You can see detail of the application you created as below, It shows Application Id & ways to generate Application secrets
Let's click on Generate New Password and retrieve a password to access this created application
Let's get back to the authentication token retrieval in Postman, we have registered an application in Microsoft Application registration portal, let's paste the Client ID and Client Secret as below
We haven't specified a reply address to the application, If you check what is the Callback URLis, its the url that redirects after application is authorized
Navigate to Application registration portal, go to Platforms section, click on Add platform button,
You will get a screen to select the platform as below, let's go with Web option
You can see web platform section as below, we have to specify the redirect url in here,https://www.getpostman.com/oauth2/callback and save changes
You can see the access token is retrieved as below
Now lets add this token in Request headers, select that option as below
You can see access token is added in headers section with Authorization as the key, click on Send button. You will see the profile information like this
Login tohttps://www.office.comyou can see all the office products as below
Click on OneDrive, you can see available files like this, now lets try to read sldevforum.xlsx file fromGraph explorer.
Opensldevforum.xlsxfile, you can view available table data like this
Lets' try to view available files in your OneDrive, you can see details of your drive as below,https://graph.microsoft.com/v1.0/me/drive
You can further query the drive and get more details, no of items in your file system etc, ping tohttps://graph.microsoft.com/v1.0/me/drive/root