By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,568 Members | 1,713 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,568 IT Pros & Developers. It's quick & easy.

How do I Export information from webpage to excel document?

P: 1
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".Webpage 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:

Expand|Select|Wrap|Line Numbers
  1. <script language="javascript">
  2. function exportToExcel()
  3. {
  4. var oExcel = new ActiveXObject("Excel.Application");
  5. var oBook = oExcel.Workbooks.Add;
  6. var oSheet = oBook.Worksheets(1);
  7. for (var y=0;y<detailsTable.rows.length;y++)
  8. // detailsTable is the table where the content to be exported is
  9. {
  10. for (var x=0;x<detailsTable.rows(y).cells.length;x++)
  11. {
  12. oSheet.Cells(y+1,x+1) =
  13. detailsTable.rows(y).cells(x).innerText;
  14. }
  15. }
  16. oExcel.Visible = true;
  17. oExcel.UserControl = true;
  18. }
  19. </script>
  20. <button onclick="exportToExcel();">Export to Excel File</button>
  21.  
  22. <table name="detailsTable">
  23. <tr>
  24. <td> hello
  25. </td>
  26. </tr>
  27. </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 "detailstable" 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!
Mar 29 '12 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.