suma237 Posted July 7, 2007 Share Posted July 7, 2007 i want to import excel file into mysql database . Thanks Quote Link to comment Share on other sites More sharing options...
Yesideez Posted July 7, 2007 Share Posted July 7, 2007 First export your Excel database out as a CSV file. You'll then need to wrote a PHP script to read the Excel file and parse the dta and populate the database. Quote Link to comment Share on other sites More sharing options...
suma237 Posted July 7, 2007 Author Share Posted July 7, 2007 how to export the Excel database out as a CSV file.? explain me in stepwise manner .please Quote Link to comment Share on other sites More sharing options...
Yesideez Posted July 7, 2007 Share Posted July 7, 2007 You can either upload your CSV to the server and read it that way or make a form where you can paste the code in. You can also make an upload form if its something that tyou want to do regularly. Once read you'd use explode() to put each row into an array then populate the table using loop. To Export the CSV in Excel, go to File>Export then select CSV from the filetype box. It'll make a standard text file. Quote Link to comment Share on other sites More sharing options...
suma237 Posted July 7, 2007 Author Share Posted July 7, 2007 please help me...i am trying to do this.thanks for your valuable time Quote Link to comment Share on other sites More sharing options...
Yesideez Posted July 7, 2007 Share Posted July 7, 2007 Help - how? Quote Link to comment Share on other sites More sharing options...
suma237 Posted July 7, 2007 Author Share Posted July 7, 2007 What it means? To Export the CSV in Excel, go to File>Export then select CSV from the filetype box. It'll make a standard text file. i need to import excel sheet into mysql Quote Link to comment Share on other sites More sharing options...
Yesideez Posted July 7, 2007 Share Posted July 7, 2007 Yes but first you need to make a CSV file by exporting the Excel file. Once you've made that CSV file as I said earlier... You can either upload your CSV to the server and read it that way or make a form where you can paste the code in. You can also make an upload form if its something that tyou want to do regularly. Quote Link to comment Share on other sites More sharing options...
suma237 Posted July 7, 2007 Author Share Posted July 7, 2007 how can i make csv file Quote Link to comment Share on other sites More sharing options...
Yesideez Posted July 7, 2007 Share Posted July 7, 2007 In Excel, "File" menu then "Save As..." then from the file requester, "select "Save as type" to be a CSV file. OK here's some questions: 1. How many rows is in your Excel document? 2. Is this a one-off or will you want to do more than one? 3. If more than one, do you want to do this regularly or only once or twice? Quote Link to comment Share on other sites More sharing options...
suma237 Posted July 7, 2007 Author Share Posted July 7, 2007 1. How many rows is in your Excel document? more than 400 2. Is this a one-off or will you want to do more than one? i am not able to understand now 3. If more than one, do you want to do this regularly or only once or twice? regularly Doubts--is the file extension is *.csv? Quote Link to comment Share on other sites More sharing options...
Yesideez Posted July 7, 2007 Share Posted July 7, 2007 Yes, the file is ".csv" OK for a Excel document having that much data you might want to either upload the CSV file to the server or write an upload script. Once the CSV file is on the server you need to go through it with a loop and explode() the line into an array. From there you can then build an INSERT query for MySQL to insert each row into the database. But that's pretty much what I've already said. Quote Link to comment Share on other sites More sharing options...
suma237 Posted July 7, 2007 Author Share Posted July 7, 2007 i saved the excel file as *.csv,but the file is saved as *.csv.xls Quote Link to comment Share on other sites More sharing options...
Yesideez Posted July 7, 2007 Share Posted July 7, 2007 Then you haven't saved it out as a CSV file then. Did you select "CSV (Comma delimited) (*.csv)" from the "Save as type" selection box? Quote Link to comment Share on other sites More sharing options...
suma237 Posted July 7, 2007 Author Share Posted July 7, 2007 yes i got it...now im trying write a code for upload the csv...thanks a lot Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.