How to export multiple tables into an excel file with separate sheet for each table? – PHP

  php

Q(Question):

Hi,

I have a database with 10 tables and I want to export all table data into excel file.But there should be only one excel file with different sheets in it, each containing different tables data.

A(Answer):

try PHPExcel

Also can export as CSV which easily can be open with excel software

A(Answer):

Hi Johny,

Thanks for the reply.I want simple code to place in my code not the folder with files in it.I really appreciate the help

A(Answer):

If by Excel file you mean ‘.xls’, then simple HTML tables can be written as a string, then write the string to a file and save as xls.

A(Answer):

Hi,

Thank you.Worked on it and I a getting the .xls file with all data in to one sheet only.But I want first table data in one sheet and second table data in 2nd sheet…..all in one abc.xls file only.

A(Answer):

Then I would advise using the class johny10151981 recommended.
Or any other PHP Excel class, as I don’t know of a simple solution

A(Answer):

ok thanks for the help.will include the classes

LEAVE A COMMENT