Hi all,
I want to automate the work of uploading excel datas to databases using PHP.
I am familiar with working on csv files and databases. But I want the XLS file which i am uploading , to be converted to CSV file using PHP before the process begins.


PLEASE HELP..

I did this myself and you can do the same. Version 1 was from CSV and for that I did a manual save to CSV from Excel first. Versions 2 and 3 do it directly from the Excel spreadsheet. This, in the end is a whole lot simpler than converting to CSV first. Going from the spreadsheet allows you to have multiple tabs in the spreadsheet and to upload from any one of them. It also gives you access to additional info about the fields. I use this to maintain parm files in Excel and then upload them into the database and it really simplifies the process. It can also identify mismatches between the spreadsheet and the database (e.g. extra or missing columns) and it tries to fix them when it finds them (sometimes a mixed blessing). I have also taken it to the point where I can predefine some of the parameters so I can provide it to clients to upload spreadsheets into the database (and get me out of the middle).

This took quite a bit of time to put together and to get it to its current state. It isn't open source and I haven't gone to the effort to package it for commercial distribution (I might still do that at some point). It relies on the open source php-excel-reader which is pretty easy to use. If you want to write this yourself then I suggest using the php-excel-reader rather than messing around with CSV.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.