HTML table to Excel using PHP

Status
Not open for further replies.

geoffm33

Ars Scholae Palatinae
710
I am running a MySQL SELECT query to dump the output to an excel file. I have tried various methods (CSV, PHP Classes to build excel docs, etc.) I ended up using a variation of a lot of the ones I have tried.

I am using an HTTP header in PHP:

Code:
header ("Content-type: application/vnd.ms-excel");

Then building the SQL query into an HTML table and it pop's open in Excel from the web browser. You can even use HTML to code the background cell colors, etc.

My problem is, the text I am pulling out of the database is Spanish with accents, tilda's, etc.

Here is how it looks displayed in the web browser:

Code:
Contrapuerta Blanca Horizon 32" ó 36"

When it outputs into excel, it looks like this:

Code:
Contrapuerta Blanca Horizon 32" Û 36"

Is there a charset I can add to the header to make the text display properly? All the copy looks fine in the browser, just not Excel.

Thanks
 
Status
Not open for further replies.