00stuff Posted May 31, 2011 Share Posted May 31, 2011 I have an excel file that has several columns with different data and I need to create a form that can upload this excel file and insert the data from the columns into its conrresponding data columns in a mysql database. I know how to create the form but I have no idea how to get the file and tell it to input each cell of data into its corresponding field in the mysql database. Does anyone know how to do this? Any help would be appreciated. Thanks, Quote Link to comment https://forums.phpfreaks.com/topic/238027-how-to-upload-excel-file-to-mysqul-with-a-htmlphp-form/ Share on other sites More sharing options...
mikosiko Posted May 31, 2011 Share Posted May 31, 2011 One option : save the excel data as a CSV file and then use LOAD DATA INFILE sentence... I don't see why you should need a form to load the data... maybe to further display/modify but not for loading. Quote Link to comment https://forums.phpfreaks.com/topic/238027-how-to-upload-excel-file-to-mysqul-with-a-htmlphp-form/#findComment-1223123 Share on other sites More sharing options...
00stuff Posted May 31, 2011 Author Share Posted May 31, 2011 I have a computer program that gives me a list of our current inventory and I can save it to an excel file. I want to create a page that I can use to upload that excel file and then use a barcode scanner to scan the inventory on our warehouse and for the program to check the code being scanned and match it with the codes that were uploaded to the database from the excel file. Would it be possible to make the php code convert the excel file into a csv and upload it so the user doesn't have to convert the excel file to csv? Quote Link to comment https://forums.phpfreaks.com/topic/238027-how-to-upload-excel-file-to-mysqul-with-a-htmlphp-form/#findComment-1223131 Share on other sites More sharing options...
dougjohnson Posted May 31, 2011 Share Posted May 31, 2011 Check this out -> http://phpexcelreader.sourceforge.net/ I've never done this but it would be very useful if it works. Quote Link to comment https://forums.phpfreaks.com/topic/238027-how-to-upload-excel-file-to-mysqul-with-a-htmlphp-form/#findComment-1223132 Share on other sites More sharing options...
gristoi Posted May 31, 2011 Share Posted May 31, 2011 I have used an open source project called PHPEXCEL for over a year. It is a very comprehensive spreadsheet manipulation class. Besides the fact it can read excel sheets as objects, it also allows you to read write and convert file formats, ie excel to csv. I have found it incredibly useful, not just for inputting but for building and creating tasty looking spreadsheets on the fly from php. Is worth a try, again you can find it at sourceforge Quote Link to comment https://forums.phpfreaks.com/topic/238027-how-to-upload-excel-file-to-mysqul-with-a-htmlphp-form/#findComment-1223139 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.