locked
Export to excel html table data. RRS feed

  • Question

  • Dear All,

    I am binding SharePoint list data to html table using spservices.

    I want to export binded html table data to excel sheet.

    Can anyone please tell me how to do this ?

    Thanks,

    Harish Patil

    Wednesday, June 15, 2016 5:37 AM

Answers

  • Hi Harish,

    You can directly export HTML to excel using below c# code

    Refer below code and link

    http://www.c-sharpcorner.com/UploadFile/ankurmalik123/export-html-to-excel-and-more/

            Response.AppendHeader("content-disposition", "attachment;filename=ExportedHtml.xls");
    
            Response.Charset = "";
    
            Response.Cache.SetCacheability(HttpCacheability.NoCache);
    
            Response.ContentType = "application/vnd.ms-excel";
    
            this.EnableViewState = false;
    
            Response.Write(YOURHTMLGOESHERE);
    
            Response.End();

    Or You can write VBA code in excel to export data in html page

    http://www.mrexcel.com/forum/excel-questions/700058-visual-basic-applications-code-extract-html-table-data-worksheet.html

    • Proposed as answer by Dean_Wang Saturday, June 25, 2016 4:34 AM
    • Marked as answer by Dean_Wang Wednesday, June 29, 2016 12:02 PM
    Wednesday, June 15, 2016 11:52 AM