简体   繁体   中英

Read excel located in Sharepoint

I already searched in Stackoverflow and found few samples using Interop.Excel.

I am using Office 2016 and Interop.Excel is targeted at 2013. I want to read an excel file located in a Sharepoint path from my C# application. User will change a cell value from the application and it should get updated in the Sharepoint file.

I checked few samples of ClosedXML but these are accessing local file and not Sharepoint.

// Starting with ClientContext, the constructor requires a URL to the
// server running SharePoint.

ClientContext context = new ClientContext("https://{site_url}");

GroupCollection siteGroups = context.Web.SiteGroups;

// Assume that there is a "Members" group, and the ID=5.
Group membersGroup = siteGroups.GetById(5);

// Let's set up the new user info.
UserCreationInformation userCreationInfo = new UserCreationInformation();
userCreationInfo.Email = "user@domain.com";
userCreationInfo.LoginName = "domain\\user";
userCreationInfo.Title = "Mr User";

// Let's add the user to the group.
User newUser = membersGroup.Users.Add(userCreationInfo);

context.ExecuteQuery();

I hope a sample code helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM