468,133 Members | 1,172 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,133 developers. It's quick & easy.

How to export data from webpage to excel sheet using javascript

Hi,
Somebody pls tell me how to export data from webpage to excel sheet using java script.
rishika
Jan 4 '07 #1
5 32543
r035198x
13,262 8TB
Hi,
Somebody pls tell me how to export data from webpage to excel sheet using java script.
rishika
Moved this to the javascript forum
Jan 4 '07 #2
Hi, I have the same problem, If you have the solution can you send it to me.

regards
Jul 31 '07 #3
gits
5,390 Expert Mod 4TB
hi ...

you cannot do this with standard-javascript (may be there is an ActiveX-Obj for IE only) ... but you may transfer the data to the server and create an excel-sheet there and then deliver it back to the client.

kind regards
Jul 31 '07 #4
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.  
  21. <button onclick="exportToExcel();">Export to Excel File</button>
Jan 21 '08 #5
acoder
16,027 Expert Mod 8TB
Hi Tushisim, welcome to TSDN!

Thanks for posting. Your solution should work, but, as stated earlier, it would only work in IE.
Jan 21 '08 #6

Post your reply

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

Similar topics

1 post views Thread by bbawa1 | last post: by
3 posts views Thread by priyanka1915 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.