read an excel file from sharepoint using MS Graph API

Kompal Sithta 71 Reputation points
2023-04-06T06:00:34.47+00:00

I am trying to read an excel file present in a folder of a site in sharepoint using MS graph API and perform certain operations on the same. I am not able to get the content in human readable format. The end point url that I have been using so far is - https://graph.microsoft.com/v1.0/sites/{site-id}/drive/root:/{site-name}/{folder-name}/{file-name}:/content

Microsoft 365 and Office SharePoint For business Windows
Microsoft Security Microsoft Graph
0 comments No comments
{count} vote

3 answers

Sort by: Most helpful
  1. Gopinath Chennamadhavuni 2,446 Reputation points
    2023-04-06T06:24:37.3233333+00:00

    Hi @Kompal Sithta Thanks for reaching out. If you are looking to download file uploaded in document library referred as driveItem driveitem-get-content.

    GET /sites/{site-id}/drives/{drive-id}/root:/{path-relative-to-root}:/content   
    GET /sites/{site-id}/drives/{drive-id}/items/{item-id}/content  
    

    If you are looking to download file uploaded to a list item referred itemAttachment, currently Microsoft Graph doesn't have support for list item attachments, you can upvote feature requested submitted by other Graph users.
    Add support for SharePoint List Item Attachments in Graph
    Ability to attach files to list items using Graph API. Hope this helps.
    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".


  2. Aleksandar Salevski 0 Reputation points
    2023-11-28T14:01:05.97+00:00

    hi i have this problem,

    User's image

    User's image

    0 comments No comments

  3. Aravinth E 0 Reputation points
    2024-10-08T17:27:27.15+00:00

    @Kompal Sithta you try the below uri, structure, it works for me.

    -> to get all rows from xlsx {Sheet} is excel workbook sheet naem and {Table name} is formated table in Sheet

    https://graph.microsoft.com/v1.0/sites/{Site ID & Group ID}/lists/{Document library List GUID}/items/{Sharepoint Item ID(number)}/driveitem/workbook/worksheets/{Sheet}/tables/{Table Name}/rows

    -> to get table header from xlsx {Sheet} is excel workbook sheet naem and {Table name} is formated table in Sheet

    https://graph.microsoft.com/v1.0/sites/{Site ID & Group ID}/lists/{Document library List GUID}/items/{Sharepoint Item ID(number)}/driveitem/workbook/worksheets/{Sheet}/tables/{Table Name}/columns?select=name

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.