|
Posted by NC on 03/12/06 00:41
Stephen Preston wrote:
>
> I have an xls worksheet I wish to export as a text or csv file
> to import with fgetcsv()
So go ahead and do it; there shouldn't be any problems...
> The 'save as' function on excell lets me save as a comma
> separated value or tab delimited text files.
> Trouble is, some of my cells already have commas in them
Doesn't matter; Excel encloses fields with commas in them in double
duotes, like this:
A simple field,"A field with a comma (,) in it",Another simple field
fgetcsv() understands this as well...
> a tab or something else would be better.
This is a matter of opinion... :)
> In the delimiter option of fgcsv(), can you specify a tab
You can if you want to:
fgetcsv($handle, 10240, "\t");
Note that since a custom delimiter is the third argument, the second
argument (the maximum length of a CSV string) must be specified...
For more information, see documentation on fgetcsv():
http://www.php.net/fgetcsv
Cheers,
NC
Navigation:
[Reply to this message]
|