Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Mar 2013
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Scan Excel File Using JavaScript

    Hi ALL,

    I am New to javascript, please help me.

    I got a situation in which I have to scan an excel file containing Three big columns as mentioned below.
    col1:First name
    col2:Last name
    col3:UID

    I have to get input from user which is FN,LN and I have to return corressponding UID as output.

    How to do this !!!!

    Please Help Me

    Thanks

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,919
    Thanks
    203
    Thanked 2,531 Times in 2,509 Posts
    It is generally not possible to read from/write to any file via JavaScript in a browser. So without any additional plug-ins you will not be able to read/write Excel files from the browser. The ActiveX objects of Excel let you do this, but only IE supports ActiveX objects. Even then the individual computer must be configured to allow it.

    If you are using IE only and are running under an intranet, please advise as then it may be possible. Otherwise you must use server-side scripting. You can read the Excel file on the server side, parse the data and return it to the Javascript client with say an Ajax request.

    If all you want out of the spreadsheet is to read tables of numbers or text fields, you should not be using .xls - export it as .csv, which is trivial to parse. But you will not be able to write to any file using Javascript.

    All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.
    Last edited by Philip M; 03-19-2013 at 05:09 PM.

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.

  • #3
    Regular Coder
    Join Date
    Jan 2013
    Location
    Germany
    Posts
    578
    Thanks
    4
    Thanked 77 Times in 77 Posts
    … unless you use HTML5: http://www.html5rocks.com/en/tutorials/file/dndfiles/
    There are also libraries to manipulate *.xlsx files, for example http://innovatejs.wordpress.com/2012...ucing-xlsx-js/

  • #4
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,297
    Thanks
    10
    Thanked 584 Times in 565 Posts
    if you can save a CSV file instead of an XLS file, then your task is trivial to accomplish using ajax, <input type=file>/dnd, or IE-only file reading tools.
    my site (updated 13/9/26)
    BROWSER STATS [% share] (2014/5/28) IE7:0.1, IE8:5.3, IE11:8.4, IE9:3.2, IE10:3.2, FF:18.2, CH:46, SF:7.9, NON-MOUSE:32%


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •