2

I have a Sharepoint Framework project (SPFx) using knockoutJS, in which the app will try to read a data from an Excel file stored in a sharepoint Document Library in a Sharepoint Online Site, using Excel Rest API.

I came across several documentations, but it didn't give me a concrete working example on how to do it.

https://learn.microsoft.com/en-us/sharepoint/dev/general-development/excel-services-rest-api

https://learn.microsoft.com/en-us/sharepoint/dev/general-development/requesting-excel-workbook-data-from-sharepoint-server-using-odata

I can't get the list of documents with this URL.

http:///_vti_bin/ExcelRest.aspx/Documents/Book1.xlsx

And i believe that i need to create some authentication method so that the app user can access the document before reading it.

I haven't used Excel Rest API and Microsoft Graph in a Sharepoint Framework (SPFx) app before.

Can anyone help me on this? I would like to see a complete working example of reading an excel file in a sharepoint online document library.

grizzthedj
  • 7,131
  • 16
  • 42
  • 62
Rommel Sudan
  • 41
  • 1
  • 2
  • 6

1 Answers1

2

For SharePoint online, you need use Microsoft graph api to access excel file from SharePoint online.

Sample endpoint:

https://graph.microsoft.com/v1.0/sites/domain.sharepoint.com,id,id/drives/drive id/items/item id/workbook

You could check the thread for more details.

http://blog.atwork.at/post/2017/12/29/Access-files-in-OneDrive-or-SharePoint-with-Microsoft-Graph-and-the-Excel-API

Use GraphHttpClient to call Microsoft Graph

Lee
  • 5,305
  • 1
  • 6
  • 12