Re: Re: excel output question
| From: | Phillip Jackson | Date: | Sat, 07 Feb 2004 09:37:47 +0000 |
| Subject: | Re: Re: excel output question | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-177089@lists.php.net to get a copy of this message | ||
I would do it like this:
$build = " '%s','%s','%s','%s'\n";
$build = sprintf($build,$field1,$field2,$field3,$fieldN);
you could also try escaping the comma. if this doesn't work you can always
just dump to html tables and save the file as *.xls (excel spreadsheet);
excel understands html tables and simple markup as spreadsheet data.
ie:
<html>
<table>
<tr>
<td>field1</td><td>field2</td><td>field3</td><td>field4</td>
</tr>
<tr>
<td>value1</td><td>value2</td><td>value3</td><td>value4</td>
</tr>
</table>
</html>
~phillip
"Jake McHenry" <linux@nittanytravel.com> wrote in message
news:006001c3ed4c$39c057f0$7fa1e518@JS...
> ----- Original Message -----
> From: "Paul Furman" <paul@edgehill.net>
> To: <php-general@lists.php.net>
> Sent: Saturday, February 07, 2004 1:56 AM
> Subject: [PHP] Re: excel output question
>
>
> > Single quote everything should work.
> >
> > Jake McHenry wrote:
> >
> > > Hi everyone. I'm outputing payroll information to an excel csv file,
and
> when anyone get's paid over 1k, the amount is split into two fields
because
> of the comma in the amount. Is there anyway I can tell excel that this
> particular comma is not a deliminator?
> > >
> > > Thanks,
> > > Jake
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
>
> like this?
>
> output =
>
"'$fullname',,'$location',,'$regularhours','$vachours','$sickhours','$compho
>
urs','$mischours','$wopyhours','$sefahours','$biweekly[0]','$adjustedtime',,
> ,,,'$sub401k
> ','$payrate','$gross5'\n";
>
> That just filled my spreadshit with quotes around everything... still the
> amounts larger than 1k are in 2 columns......
>
> did I do something wrong?
>
> Thanks,
> Jake