简体   繁体   中英

How to get data from excel sheet in a loop using jquery?

I am trying to get data from excel to jquery loop? Can someone help me on this?

Please specify more information so people would know how to adress your problem. You are trying to upload excel file to website and then show its contents with javascript? Or I am mistaken?

EDIT: As I see it you have two ways of doing it: One of them is use ActiveX to do that (like mnh suggested) or you can read file with server-side language using ome kind of library to open excel file (for example,for php this one can be used - PHPExcel library ) , get it via ajax to webpage then use jquery to process excel data and display it

you can use jquery for Ajax calls - like here :

http://net.tutsplus.com/tutorials/javascript-ajax/5-ways-to-make-ajax-calls-with-jquery/

or

http://www.devirtuoso.com/2009/07/beginners-guide-to-using-ajax-with-jquery

I think you'll need ActiveX. Search for "activex javascript excel". Here is an example

ActiveXObject Javascript

Also look into the Excel Object Model .

I can't think of any reliable and cross-browser method (not to mention easy to implement) to read an Excel file from client-side JavaScript, except (maybe) writing a Flash application to act as proxy between the binary file and the page's JavaScript environment.

It also looks like a kind of weird requirement, anyway. Is it possible that what the client is really asking for is a form to upload an Excel file and have it displayed in a web site plus some fancy jQuery animations on the resulting HTML?

If I had to do such task, I would do this:

  1. Write an HTML form with an <input type="file"> control.
  2. Write a server-side PHP application that: 2.1 Receives the file upload. 2.2 Open it as Excel file and extract data with a library like PHP-ExcelReader or PHPExcel . 2.3 Generate an HTML table with the aforementioned data.
  3. Code some fancy animations in jQuery.

Last but not least, I'm not an advanced Microsoft Office user but I believe Excel provides a "Save as Web Site" feature that allows to generate HTML linked to the source file. I've never used it and don't know if it'll suit your needs or not but it's there.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM