How do I Export information from webpage to excel document?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Derek Dunn
    New Member
    • Mar 2012
    • 1

    How do I Export information from webpage to excel document?

    Hello all,

    I am very new to HTML and java coding, and I'm putting together a relatively simple HTML page. Specifically, the HTML page is a checksheet with various tasks to check off .

    In general, here is the process (I only need code for step 5).
    1) Operators open a QA webpage (already coded)
    2)Operators enter "Employee Number" and "Workcenter " on QA Webpage.
    3)Operator clicks on a checkbox for "PM Check sheets", which opens a POP-up webpagewindow, unique to each workcenter (This isnt the code i want, but just wanted to walk through the process)
    4)Operator checks all checkboxes within the POP-UP webpage window
    5) Operator Clicks "Submit".Webpag e transfers "Employee number" and "Work center" into an excel sheet and saves the data.

    Its a relatively basic application but I dont know much HTML coding. All of the information I have found involved a third program like jquery or something else.

    I have, however, stumbled open code within these forums that may work, but I dont see the pointer to a specific excel file for the webpage to load to. The code that I found is as follows:

    Code:
    <script language="javascript">
    function exportToExcel()
    {
    var oExcel = new ActiveXObject("Excel.Application");
    var oBook = oExcel.Workbooks.Add;
    var oSheet = oBook.Worksheets(1);
    for (var y=0;y<detailsTable.rows.length;y++)
    // detailsTable is the table where the content to be exported is
    {
    for (var x=0;x<detailsTable.rows(y).cells.length;x++)
    {
    oSheet.Cells(y+1,x+1) =
    detailsTable.rows(y).cells(x).innerText;
    }
    }
    oExcel.Visible = true;
    oExcel.UserControl = true;
    }
    </script>
    <button onclick="exportToExcel();">Export to Excel File</button>
     
    <table name="detailsTable">
    <tr>
    <td> hello
    </td>
    </tr>
    </table>
    Since I do not see specific file / file location, I have no idea where the exported data is going...in addition i assume the "detailstab le" is a HTML table? I'm not sure... If someone could walk me through the code I may be able to figure it out (I am proficient at excel coding so i can read through code pretty well, altho excel is very basic programming)

    Any help would be very much appreciated. Thanks!
    Last edited by Derek Dunn; Mar 29 '12, 08:28 PM. Reason: previous post had sentences jumbled together
Working...