How to list rows in excel table

Vladimir Privalov 0 Reputation points
2023-03-29T18:11:11.49+00:00

I'm trying to get data from rows of a sheet in a .xlsx file shared with me in OneDrive. I have found a way to get data from sheet using range of rows and columns like that

https://graph.microsoft.com/v1.0/me/drives/<drive_id>/items/<item_id>/workbook/worksheets('Sheet1')/range(address='a1:a9')?$select=values

However this method is not good enough as we don't know how much data will be stored in the table.

Moreover I tried solution proposed in this thread:

https://graph.microsoft.com/v1.0/me/drive/items/{items-id}/workbook/worksheets/{Sheets-id}/tables/{Table-id}/rows

But this way I failed to get data for table with correct Table-id.

1

2

Is there more flexible way to retrieve data from excel sheet?

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

1 answer

Sort by: Most helpful
  1. HarmeetSingh7172 4,811 Reputation points
    2023-03-31T00:29:48.0933333+00:00

    Hello Vladimir Privalov,

    Thanks for reaching out!

    As per my testing, List Rows Graph API is working as expected. I'm using below Graph endpoint to get the rows in a table.

    GET /me/drive/items/{id}/workbook/worksheets/{id|name}/tables/{id|name}/rows

    However, on using GET /me/drive/items/{id}/workbook/worksheets/{id|name}/tables, when I don't have any tables in my worksheet returns NULL response.

    Please make sure you are querying on right worksheet to get the table data and rows.

    Hope this helps.

    If the answer is helpful, please click Accept Answer and kindly upvote. If you have any further questions about this answer, please click Comment.