Re: Converting tab delimited file to CSV
| From: | Robert Cummings | Date: | Mon, 18 Feb 2008 16:34:39 +0000 |
| Subject: | Re: Converting tab delimited file to CSV | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-269485@lists.php.net to get a copy of this message | ||
On Mon, 2008-02-18 at 05:20 -0800, Hiep Nguyen wrote:
> On Mon, 18 Feb 2008, Graham Cossey wrote:
>
> > I was wondering if someone could offer some advice please.
> >
> > I'm being sent data in tab delimited files which I'm trying to split
> > into smaller files and convert to comma delimited using PHP.
> >
> > Now, I can replace the tabs with commas and opening the resulting
> > files in a basic text editor all looks fine. However when I open the
> > files in M$ Excel they're still being treated as tab delimited and all
> > values are being shoved into a single column.
> >
> > What can I do in the PHP code to specifically make the file CSV and be
> > treated as such by M$ Excel?
> >
> > I'm currently just using fopen for old and new files and fwrite.
> >
>
> don't double-click on file_name.csv, instead open MS Excel, then click on
> file open and locate your file, then you'll know what to do from there.
That's funny... MS defaults to tabs for a file whose extension is .csv
which is an acronym for (C)omma (S)eparated (V)alues.
Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com
|
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'