How to read data from excel file from sharepoint in C# .net framework using webaddress of the file in Excel.Path

Mohsin Raza 21 Reputation points


Can i get some help to find the answer ,how to read data from excel file in company sharepoint in C# .net framework using webaddress of the file ?


An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,640 questions
SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
2,807 questions
{count} votes

Accepted answer
  1. RaytheonXie_MSFT 33,641 Reputation points Microsoft Vendor

    Hi @Mohsin Raza
    Per my test, you can use the following code to get excel file in sharepoint

    using (ClientContext ctx = new ClientContext(""))  
        ctx.Credentials = new SharePointOnlineCredentials(userName, securePassword);  
        Web web = ctx.Web;  
        ctx.Load(web, a => a.ServerRelativeUrl);  
        FileInformation fileInfo = Microsoft.SharePoint.Client.File.OpenBinaryDirect(ctx, "/sites/aaa/Coding/1/sssss.xlsx");  
        var filePath = @"c:\abc\Test\sssss.xlsx";  
        using (var fileStream = new System.IO.FileStream(filePath, System.IO.FileMode.Create))  

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful