Is there a way to programatically edit Office 365 Excel documents?

user2102611 picture user2102611 · Jun 10, 2016 · Viewed 8.2k times · Source

I have to update a spreadsheet that looks like this.

enter image description here

It's not hard at all. I just go to the last line and enter what I need in the appropriate columns. I'd like to automate this. The first thing I tried was Selenium Webdriver but the results are too slow and hit and miss. The next thing I checked was for an API but it looks like there is nothing for Excel.

I could use Selenium to download the file and then use a C# app to modify it as an excel file and then reupload it. At the point though I'm wondering if Google Docs has an easier solution.

So is there any way to programatically modify an excel online spreadsheet?

Answer

Andrew Hall picture Andrew Hall · Jun 11, 2016

I'm aware of 4 options to programmatically modify Excel Online via JavaScript or REST:

  1. Office Add-ins platform: https://dev.office.com/docs/add-ins/overview/office-add-ins
  2. Excel Services JavaScript API - EWA Excel Web Access Namespace (not updated in couple years): https://msdn.microsoft.com/en-us/library/hh315812(v=office.14).aspx
  3. Excel Services REST API (via SharePoint Online): https://msdn.microsoft.com/en-us/library/ee556842(v=office.14).aspx
  4. Microsoft Graph REST API (Excel Objects are currently in Beta): https://graph.microsoft.io/en-us/docs/api-reference/beta/resources/excel