MySQL to EXCEL?

MySQL to EXCEL?

am 17.08.2004 21:36:49 von Chris Payne

------=_NextPart_000_0000_01C48470.036F0EB0
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit

Hi there everyone,



I'm having a dilemma (Now that I have power back after the hurricane hit us
directly in Orlando). Anyway, I need to export a database table to Excel, I
can do it as a .txt file without a problem, but I can't seem to get it to
put each column into a separate cell when I try to export as an .xls form, I
think I have this line formed incorrectly for an XLS file, can anyone see if
I need to use any special characters rather than a comma?



fwrite($filesession,"$id,$new,$recno,$category,$product,$des cription,$unit,$
certificate,$instock,$orderpt,$ordernow,$vendor,$unitcost,$u nitsell\015\012"
);



Thank you.



Chris


------=_NextPart_000_0000_01C48470.036F0EB0--

Re: MySQL to EXCEL?

am 17.08.2004 21:53:02 von h.dudeness

> I'm having a dilemma (Now that I have power back after the hurricane hit us
> directly in Orlando). Anyway, I need to export a database table to Excel, I
> can do it as a .txt file without a problem, but I can't seem to get it to
> put each column into a separate cell when I try to export as an .xls form, I
> think I have this line formed incorrectly for an XLS file, can anyone see if
> I need to use any special characters rather than a comma?
>
> fwrite($filesession,"$id,$new,$recno,$category,$product,$des cription,$unit,$
> certificate,$instock,$orderpt,$ordernow,$vendor,$unitcost,$u nitsell\015\012"
> );
>


either output the data as a csv which you are doing (on windoze name
the file with a .csv extension) or take a look at
http://pear.php.net/package/Spreadsheet_Excel_Writer

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: MySQL to EXCEL?

am 17.08.2004 21:59:33 von Randy

You could always use phpMyAdmin...I believe it will export to Excel
(if not, CSV file).

http://phpmyadmin.sourceforge.net/



On Tue, 17 Aug 2004 15:36:49 -0400, Chris Payne
wrote:
> Hi there everyone,
>
> I'm having a dilemma (Now that I have power back after the hurricane hit us
> directly in Orlando). Anyway, I need to export a database table to Excel, I
> can do it as a .txt file without a problem, but I can't seem to get it to
> put each column into a separate cell when I try to export as an .xls form, I
> think I have this line formed incorrectly for an XLS file, can anyone see if
> I need to use any special characters rather than a comma?
>
> fwrite($filesession,"$id,$new,$recno,$category,$product,$des cription,$unit,$
> certificate,$instock,$orderpt,$ordernow,$vendor,$unitcost,$u nitsell\015\012"
> );
>
> Thank you.
>
>
> Chris
>
>


--
randy sesser@gmail.com

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

RE: MySQL to EXCEL?

am 17.08.2004 22:55:29 von ed.lazor

> -----Original Message-----
> either output the data as a csv which you are doing (on windoze name
> the file with a .csv extension) or take a look at
> http://pear.php.net/package/Spreadsheet_Excel_Writer

I have another option that might work for you also. Go to MySQL's website
and grab their ODBC driver and use that to pull data directly into Excel.
That's what I do and the end result tends to be a lot cleaner than going
through cvs or other MySQL exports.

-Ed

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: MySQL to EXCEL?

am 17.08.2004 23:09:19 von h.dudeness

> I have another option that might work for you also. Go to MySQL's website
> and grab their ODBC driver and use that to pull data directly into Excel.
> That's what I do and the end result tends to be a lot cleaner than going
> through cvs or other MySQL exports.

I was not sure that this was a mysql db.

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: MySQL to EXCEL?

am 17.08.2004 23:33:17 von h.dudeness

> > I have another option that might work for you also. Go to MySQL's website
> > and grab their ODBC driver and use that to pull data directly into Excel.
> > That's what I do and the end result tends to be a lot cleaner than going
> > through cvs or other MySQL exports.
>
> I was not sure that this was a mysql db.

sorry for the second email, I see now in the subject of the email it
is mysql, stupid me.

You could also try an excel com object to do this.

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: MySQL to EXCEL?

am 17.08.2004 23:45:29 von Danbru

I don't know how you have it setup.

But you can create a XLS file on the fly using PHP....

By using header...

header("Content-Type: application/vnd.ms-excel");
header("Content-Dispostion: attachemnt; filename='Project.xls'");
header("Pragma: no-cache");
header("Expires: 0");


Then just echo your results from your query, like normal...


You have just created a XLS from PHP...Which can be saved to a XLS
Workbook...




Dan







On Aug 17, 2004, at 4:33 PM, h.dudeness@gmail.com wrote:

>>> I have another option that might work for you also. Go to MySQL's
>>> website
>>> and grab their ODBC driver and use that to pull data directly into
>>> Excel.
>>> That's what I do and the end result tends to be a lot cleaner than
>>> going
>>> through cvs or other MySQL exports.
>>
>> I was not sure that this was a mysql db.
>
> sorry for the second email, I see now in the subject of the email it
> is mysql, stupid me.
>
> You could also try an excel com object to do this.
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

RE: MySQL to EXCEL?

am 18.08.2004 02:50:35 von ed.lazor

> -----Original Message-----
> From: Daniel Brunner [mailto:daniel.brunner@duni.com]
> Sent: Tuesday, August 17, 2004 2:45 PM
> To: php-db@lists.php.net
> Subject: Re: [PHP-DB] MySQL to EXCEL?
>
> I don't know how you have it setup.
>
> But you can create a XLS file on the fly using PHP....
>
> By using header...
>
> header("Content-Type: application/vnd.ms-excel");
> header("Content-Dispostion: attachemnt; filename='Project.xls'");
> header("Pragma: no-cache");
> header("Expires: 0");
>
>
> Then just echo your results from your query, like normal...

Could you expound on this? What field delimiter are you using?


>
>
> You have just created a XLS from PHP...Which can be saved to a XLS
> Workbook...

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

RE: MySQL to EXCEL?

am 18.08.2004 03:22:11 von Jeffrey_N_Dyke

>>
>> I don't know how you have it setup.
>>
>> But you can create a XLS file on the fly using PHP....
>>
>> By using header...
>
>> header("Content-Type: application/vnd.ms-excel");
>> header("Content-Dispostion: attachemnt; filename='Project.xls'");
>> header("Pragma: no-cache");
>> header("Expires: 0");
>>
>>
>> Then just echo your results from your query, like normal...

> Could you expound on this? What field delimiter are you using?

You can use





and each tr becomes an excel row and each td becomes a cell. This may or
may not work in/before excel97??

If you're looking to create true excel files, then i highly suggest
spreadsheetwrite_excel,
It is an excellent codeset, enabling you to use many features of excel such
as colors, math, formats, etc.

doing it this way, is little to no different from exporting in csv format,
but it does work
as described.

HTH
Jeff


>
>
> You have just created a XLS from PHP...Which can be saved to a XLS
> Workbook...

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

RE: MySQL to EXCEL?

am 18.08.2004 06:41:44 von ed.lazor

> -----Original Message-----
>
> You can use
>


>
>

>
> and each tr becomes an excel row and each td becomes a cell. This may or
> may not work in/before excel97??
>
> If you're looking to create true excel files, then i highly suggest
> spreadsheetwrite_excel,
> It is an excellent codeset, enabling you to use many features of excel
> such
> as colors, math, formats, etc.
>
> doing it this way, is little to no different from exporting in csv format,
> but it does work
> as described.
>
> HTH
> Jeff

Wow, that's pretty interesting. I'll play around with it =)

-Ed

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php