Re: Converting tab delimited file to CSV
| From: | Wolf | Date: | Mon, 18 Feb 2008 16:37:47 +0000 |
| Subject: | Re: Converting tab delimited file to CSV | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-269487@lists.php.net to get a copy of this message | ||
---- Graham Cossey <graham.cossey@gmail.com> 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.
>
> --
> Graham
When using MicroShaft products to open generated files, you will need to open M$ software first,
then use File -> Open to correctly open the file.
M$ Excel uses TABS to split their CSV files (don't ask why, it's MicroShaft) so
you'll have to play/tweak your files to get them to open correctly.
Wolf