Thanks to all for your help. I solved my problem the
quick and dirty way. Here's what I did:

1. Created my Excel spreadsheet to look the way I
wanted it, saved it as an XML spreadsheet.

2. Used PHP to pull the desired data from the MySQL
server on our iSeries machine.

3. PHP writes the XML data to a new text file using
the values from the MySQL DB and gives it the ".xls"
extension.

4. Browser is redirected to the new spreadsheet.

5. Spreadsheet opens like normal in IE for
saving/downloading. Or in Firefox it lets you download
it and it opens like a normal .xls spreadsheet.

Thanks to everyone here for their insight. I coudln't
have achieved it without all of you!

-Nick

--- inferno <[EMAIL PROTECTED]> wrote:

> Hi,
> 
>     I had to do the same thing on a project and the
> problem was that if 
> you use CSV you will not be able to make a formated
> excel document.
>     I am using now *Spreadsheet_Excel_Writer 
> </package/Spreadsheet_Excel_Writer> ( 
>
*http://pear.php.net/package/Spreadsheet_Excel_Writer
> ) and it does 
> everything I need, including formating the page for
> printing, color, 
> bold and boarder on cells and the best part is that
> it's no really hard 
> to use.
>     If you change your mind and want to generate
> that from perl you also 
> have some PEAR packages for that, but I've sticked
> to PHP and with this 
> the problem was solved and I generate my data on
> access, custom build 
> depending on the select.
> 
> Best regards,
> Cristi Stoica
> 
> Arjan Hulshoff wrote:
> 
> >Hello Nick,
> >
> >This you can do with the MySQL ODBC Driver
> installed
>
>(http://dev.mysql.com/downloads/connector/odbc/3.51.html).
> Further more
> >you need to activate Microsoft ActiveX Data Objects
> in the references.
> >You can use the following code:
> >
> ><--Begin Code-->
> >Dim cn As ADODB.Connection
> >Dim rs As ADODB.RecordSet
> >
> >Set cn = New ADODB.Connection
> >Set rs = New ADODB.RecordSet
> >
> >cn.ConnectionString = "DRIVER={MySQL ODBC 3.51
>
>Driver};SERVER=data.domain.com;PORT=3306;DATABASE=myDatabase;USER=myUser
> >name;PASSWORD=myPassword;OPTION=3;"
> >cn.Open
> >
> >sSQL = "SELECT * FROM database"
> >
> >rs.Open sSQL, cn
> >
> >If Not rs.BOF Then rs.MoveFirst
> >Do While Not rs.EOF
> >     Cells(1, 1) = rs.Fields(<index>)        ' This line you
> can
> >adjust with your own code
> >     rs.MoveNext
> >Loop
> >
> >On Error Resume Next ' This is my solution to make
> sure that the
> >recordset is always closed, _
> >                                     without the errorhandling there
> >occurs an error when you use a query _
> >                                     that doesn't return results
> >('INSERT' e.g.). If there is a better way _
> >                                     to close the connection, then
> >let me know.
> >If rs.State = adStateOpen Then rs.Close
> >On Error Goto 0
> >cn.Close
> >
> >Set rs = Nothing
> >Set cn = nothing
> ><--End Code-->>
> >
> >HTH,
> >Arjan.
> >
> >-----Original Message-----
> >From: Nick Jones [mailto:[EMAIL PROTECTED] 
> >Sent: Thursday, September 01, 2005 08:23 PM
> >To: mysql@lists.mysql.com
> >Subject: Populate values in an Excel sheet from
> MySQL
> >
> >Does anyone know if it is possible to populate
> values into an Excel
> >spreadsheet from a MySQL database? Can I do this
> directly in Excel or do
> >I need to create an external program to do the work
> (i.e. in VB).
> >
> >Thanks
> >-Nick
> >
> >__________________________________________________
> >Do You Yahoo!?
> >Tired of spam?  Yahoo! Mail has the best spam
> protection around
> >http://mail.yahoo.com 
> >
> >--
> >MySQL General Mailing List
> >For list archives: http://lists.mysql.com/mysql
> >To unsubscribe:
>
>http://lists.mysql.com/[EMAIL PROTECTED]
> >
> >
> >
> >  
> >
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to