SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Addict
    Join Date
    Oct 2008
    Location
    Virtual World is my location
    Posts
    311
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    Question Excel Spreadsheet to Array via Javascript?

    Actually, I was having issues converting Excel Spreadsheet to database. But that does not seem to work directly.

    This is the other ongoing thread : http://www.sitepoint.com/forums/show...ultiple-tables

    Hence, I read while searching that it might be possible to convert an excel spreadsheet to an array using JS

    So is there any way I could upload a CSV file and the JS converts it into a specific array? This could be used by me to pass it to the PHP script which in turn could add it to the database

    Thanks for all the help in advance.
    RecipesNext.com - recipes, kitchen queries, videos & more...
    BargainNext.com - coupons / deals / bargains / offers & more...

  2. #2
    Community Advisor bronze trophy
    fretburner's Avatar
    Join Date
    Apr 2013
    Location
    Brazil
    Posts
    1,412
    Mentioned
    45 Post(s)
    Tagged
    12 Thread(s)
    Hi jaagare,

    Having read your other thread that you linked to, I think your best option is probably to use PHP, with a library such as PHPExcel, to import the data from the spreadsheet into your DB. I've done something similar in the past with a system that imported supplier stock lists in Excel format.

  3. #3
    SitePoint Addict
    Join Date
    Oct 2008
    Location
    Virtual World is my location
    Posts
    311
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    Thanks

    @fretburner Thank you for the link. Will definitely check it out and try to work it out as per my requirements. Will let you know how it goes. Thanks
    RecipesNext.com - recipes, kitchen queries, videos & more...
    BargainNext.com - coupons / deals / bargains / offers & more...

  4. #4
    SitePoint Addict
    Join Date
    Oct 2008
    Location
    Virtual World is my location
    Posts
    311
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    For anyone else wanting a solution that I want, I find that jquery seems to have an option to automatically enter array in to a HTML form online using console.log function.

    I am studying in detail regarding this function but I feel that it might solve my issue. First I would need to store the CSV to an array and then from an array run the jQuery script which in turn would fill up all the form data using the above function.

    Will keep posted if I succeed or if anyone has already done such a thing it would be great if you could share any link if there are existing examples in this regard.
    RecipesNext.com - recipes, kitchen queries, videos & more...
    BargainNext.com - coupons / deals / bargains / offers & more...

  5. #5
    SitePoint Member
    Join Date
    Aug 2013
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you're interfacing with the CSV for database purposes, you'd probably be better off using PHP. It has native CSV support built in by using the fgetcsv function.

    If you need the user to upload the file, and then make changes, you could use a form to post the file, read it, and then return a JSON object to parse on the front-end.

  6. #6
    SitePoint Addict
    Join Date
    Oct 2008
    Location
    Virtual World is my location
    Posts
    311
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    @jaydub Thanks. Will definitely check fgetcsv too.
    RecipesNext.com - recipes, kitchen queries, videos & more...
    BargainNext.com - coupons / deals / bargains / offers & more...


Tags for this Thread

Bookmarks

Posting Permissions

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