-2

i have a html dynamic html table, i want to download this table as excel file.And after downloading i could make some changes in it and again upload it to a folder where it would change the database data according to fields..I was able to download the html table to an excel file, but have no idea how after changing the contents in the excel file would update the database according to it.I have heard of tongue twisters but this nerve twisting.

rahul
  • 841
  • 1
  • 8
  • 18
  • You're looking to upload and parse a csv file, which is answered here: http://stackoverflow.com/a/5593885/1352271 – JohnnyFaldo Jul 26 '13 at 05:26
  • possible duplicate of [Dynamically change the downloaded filename](http://stackoverflow.com/questions/17876387/dynamically-change-the-downloaded-filename) – e-sushi Jul 26 '13 at 13:35

2 Answers2

1

You may want to take a look at the PHPExcel library, available at phpexcel.codeplex.com.

e-sushi
  • 13,786
  • 10
  • 38
  • 57
bansi
  • 55,591
  • 6
  • 41
  • 52
0

If you want to do this with JS (I not recommend) you could copy/paste the excel content to a textarea in your HTML and then with JS you can do:

 var temp = document.getElementById("yourtextarea").value.split("   ");

Since excel by default separates columns with '(tab)' you can explode it and save in the DB. You will also have to explode the newlines. It could be \r\n or just \n depending on your OS. After doing so, you can commit it to the database, row by row using Ajax.

If you can do it with PHP then would be much more easier. You could you explode() using newline at first (to break lines) and tab at finally (to break columns).

e-sushi
  • 13,786
  • 10
  • 38
  • 57
amandanovaes
  • 694
  • 2
  • 7
  • 20