How can I add table rows to an excel file in a Sharepoint Document Library?

Janice Lehmann20Reputation points
2025-04-22T14:24:32.7566667+00:00

I know, that it is possible to add one or multiple rows by Graph API to a workbook stored on users OneDrive.

But i would like to create rows in an excel file stored on Sharepoint in an Document Library. Is that possible? How should the url looks like?

I also tried to do this with Power Automate and the Action "Send an HTTPS Request to Sharepoint", but this way it did not work too.

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
13,518 questions
0 commentsNo comments
{count} votes

1 answer

Sort by: Most helpful
  1. SrideviM2,460Reputation pointsMicrosoft External Staff
    2025-04-24T12:35:21.4266667+00:00

    Hello Janice Lehmann,

    I understand you are trying to add rows to an Excel file saved in a SharePoint Document Library using Microsoft Graph, and yes, that can be done.

    The main thing is to use the correct URL format for SharePoint. Instead of the OneDrive path, you’ll use something like this:

    POST https://graph.microsoft.com/v1.0/sites/{site-id}/drives/{drive-id}/items/{item-id}/workbook/tables/{table-name}/rows/add 

    To fill in this URL, you’ll need a few IDs.

    In my case, I have an Excel file named EmployeeData.xlsx stored in the sridoclib document library of the "sridemosite" SharePoint site:

    enter image description here

    To get the SharePoint site ID, you can use this Graph API call:

    GET https://graph.microsoft.com/v1.0/sites/root:/sites/<sitename> 

    enter image description here

    Next, to get the document library (drive) ID, check this API call:

    GET https://graph.microsoft.com/v1.0/sites/{site-id-from-above}/drives 

    enter image description here

    Then, to get the Excel file's ID (item ID):

    GET https://graph.microsoft.com/v1.0/sites/{site-id}/drives/{drive-id-from above}/root:/<filename>.xlsx 

    enter image description here

    Once you have all of those, you can send data to the table inside the Excel file.

    Here’s the request:

     POST https://graph.microsoft.com/v1.0/sites/{site-id}/drives/{drive-id}/items/{item-id}/workbook/tables/{table-name}/rows/add { "index": null, "values": [ ["Sri", "Cloud"] ] } 

    enter image description here

    Before running the API call, my Excel table looked like this:

    enter image description here

    After running the POST call, the new row was added successfully:

    enter image description here

    You can refer to this Microsoft documentation to review the required permissions for this API call.

    Hope this helps!


    If this answer was helpful, please click "Accept the answer" and mark Yes, as this can help other community members.

    User's image

    If you have any other questions or are still facing issues, feel free to post in the comments and I’ll be happy to assist further.


Your answer