Dec 20 2022 11:21 PM
Hi,
I have a python3 script which generates a particular set of data that gets updated to a locally stored Csv/Excel file. I am using Openpyxl package in python to achieve the same.
But the requirement has changed such that the data should be available in a shared platform were multiple personnals can view, edit and export as and when required. This lead to the idea of creating an excel sheet in the microsoft office 365 Excel and updating the sheet so that all the requirements can be met.
Unfortunately, I couldnt find any documentation or tutorial that lets someone update an Excel sheet in office 365 even though i spent a considerable amount of time searching online.
My requirement is to have an API that can take the row in some format and update it to the Excel sheet under my login.
Please help me find a solution to this question or any other alternative that would help to achieve the matter at hand.
Dec 21 2022 03:28 AM - last edited on Dec 21 2022 10:37 AM by EricStarker
Dec 21 2022 03:28 AM - last edited on Dec 21 2022 10:37 AM by EricStarker
SolutionYou can use the Microsoft Graph API to update an Excel sheet stored in OneDrive from a Python script running locally. Here's an example of how you can do this:
First, you will need to register your app in the Azure portal and get the necessary credentials (client ID and client secret) to authenticate your app with the Microsoft Graph API.
Next, install the requests and adal libraries in your Python environment:
I hope this helps! Let me know if you have any questions.
Dec 21 2022 09:44 AM
@Raysilver01 the answer you gave is unclear.
please explain with an example code snippet if possible.
Thanks.
Dec 21 2022 11:45 PM
Hi @traza8545,
Thank you for your reply.
My requirement is to update/write to an already existing excel worksheet. Will you be able to reply with the specific API for this action?
Apologize for the inconvinience but im not able to find an API for update purposes.
Dec 23 2022 02:41 AM
Hi @traza8545,
I was able to view all the items present in my ondrive using a Graph API https://graph.microsoft.com/v1.0/me/drive/root/children/sites.
Also found another API to add rows to an excel sheet: https://graph.microsoft.com/v1.0/drives/{drive-id}/items/{item-id}/workbook/worksheets/Sheet1/tables...
But it keeps giving me the error mentioned below:
Jul 10 2023 10:24 PM
Dec 21 2022 03:28 AM - last edited on Dec 21 2022 10:37 AM by EricStarker
Dec 21 2022 03:28 AM - last edited on Dec 21 2022 10:37 AM by EricStarker
SolutionYou can use the Microsoft Graph API to update an Excel sheet stored in OneDrive from a Python script running locally. Here's an example of how you can do this:
First, you will need to register your app in the Azure portal and get the necessary credentials (client ID and client secret) to authenticate your app with the Microsoft Graph API.
Next, install the requests and adal libraries in your Python environment:
I hope this helps! Let me know if you have any questions.