Hello every one,

i want to make a programme that read data from .xls file. a sql table will create on the basis of top row of the xls file, and rest rows will treated as data and inserted into the table.

actually i am working for a office, their employees are making reports in xls file. all the files are different format. i want that my php programme read xls file and create a table in sql and insert data in it. top row of xls file is used to create table.

plz help me to do this.

thanks

Gajendra

If you export your XLS as CSV, then MySQL can import it with LOAD DATA. Here's a thread about it.

commented: same as i would do +6

To confirm it I really doubt there will be any way to import a xls into mysql - microsoft has xls files saved in an encrypted format that you need a program to translate - I would do what Pritaeas says and you can make the top row using the headers in the file etc.

wow i stand corrected, i just saw that phpexcel in the link - could well be possible with that but i've never used it. I'd switch to csv if possible it's a universally accepted format for data

could well be possible

With PhpExcel you still need PHP coding to get everything into MySQL.

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.