ASP.NET Core Excel Viewer Control
How to open, view a Excel .xlsx document online in web browser without Office, interop using C# ASP.NET

How to read, view, edit Microsoft Office Excel in web browser using C# ASP.NET PDF Viewer control.

EdgePDF is an ASP.NET PDF viewer and editor web control. You could also view Microsoft Office Excel file in web browser with EdgePDF using C# ASP.NET

  • Open, read a Excel file from server side file system
  • EdgePDF will automatically convert loaded Excel Workbook or selected Sheets to PDF document in ASP.NET
  • View, comment Excel file online in web browser
  • Support ASP.NET Core, ASP.NET MVC (.net framework) web app, deploy to Azure web service

How to view a Excel file programmatically in core using C#

  1. Download EdgePDF PDF viewer web control
  2. Install EdgePDF demo project in IIS
  3. Follow step by step tutorial


To run the following tutorial successfully, we need the following setup ready.

  1. For ASP.NET Core web app: Setup EdgePDF
  2. For ASP.NET Core MVC web app: Setup EdgePDF
  3. For ASP.NET (.net framework): Setup EdgePDF on IIS
  4. A demo Office Excel document in folder C:\temp\excel-1.xlsx

How to read, view a Office Excel file online in web browser in ASP.NET C#?

The following steps and C# demo source code will help to setup a demo ASP.NET project, which allows you to read, view a Microsoft Excel file in web browser using ASP.NET C# code.

After you have completed the following guide, you can open, view a Office Excel file online in web browser through url (a sample url http://localhost:56643/?yourtarget=excel-1.xlsx)

  • For ASP.NET Core web app, open file UserCommandProcessMiddleware.cs from /DemoProjects/EdgePDF for ASP.NET Core/

  • For ASP.NET (.net framework) project, open file UserCommandProcessHandler.ashx from {EdgePDF demo project}/RasterEdge_Resource_Files/

  • Go to method FileProcess()
  • Create a new byte[] object with viewed Excel file in byte array
  • Call method REProcessControl.PageLoadFile() to load, view Excel file in EdgePDF. The Excel file (excel-1.xlsx) has been converted into PDF file and rendered in EdgePDF online in web browser

    public override PDFWebDocument FileProcess()
        HttpRequest request = this.Context.Request;

        if (!String.IsNullOrEmpty(request.QueryString["yourtarget"]))
            String docid = request.QueryString["yourtarget"];

            byte[] dataBytes = System.IO.File.ReadAllBytes(@"C:\\temp\" + docid);
            return REProcessControl.PageLoadFile(request, this.Manager, dataBytes, docid);
            Logger.Log(">>> Unknown load file mode. Load default file defined in Web.config.", LogType.DEBUG);

            // load default file. defined in Web.config
            return REProcessControl.PageLoadFile(request, this.Manager, "", LoadType.Server);

After complete the ASP.NET Excel viewer web application, you could easily publish the ASP.NET Core web app to Azure cloud service. View details at How to deploy ASP.NET Excel viewer web application to Azure?