• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Import from and export to Excel

 
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
We have a table in our page. When user right clicks on the table, a context menu is shown and in that we have two menu items: Export to Excel and Import from Excel. We need the table to be imported from and exported to Excel. Everything should be done at client side. How to do this? I have no idea how the .xls file format would be. How to launch the Excel window when he selects 'Export to Excel'?. When he selects 'Import from Excel', we need to show a browse folder dialog and then he selects the .xls file. How to convert this into the html table?
Thanks a lot in advance.
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
it has to be done sever side since javascript has no control over redaing and writing to files. ASP can read excel files and write to them. There may be some active X thing.
<input type="file"> will allow you to browse.
The only hting i think you might be able to do is do it with frames and have the top frame be the info and the bottom frame being the excel sheet.
 
Adithya Rayaprolu
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi eric,
Thanks for the info. For testing purpose, we created an html table in a text file and named it as test.xls, I wrote a function which has only one line
window.open('test.xls','','resizable=yes,height=475,width=800');
When I call this function from the context menu item, its perfectly showing the excel speadsheet.
I have one more question. In Javascript, we cannot do file reading or writing. So, we have to send the table data to server and let server convert the data into an xls file, and when we receive it, we can show it in excel. How do we send the whole table data to the server?
And in Import from Excel, we will get the file name from the dialog. How do we send the file contents to server, so it can send us the xls file data to a simple html table?
Thanks.
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
look here: http://www.asp101.com/samples/xl.asp
see if this helps
 
"Don't believe every tiny ad you see on the internet. But this one is rock solid." - George Washington
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic