PHP Parse Delimited .xls file
Posted: Sat Jul 21, 2007 12:29 pm
feyd | Please use
Here's a line to the .xls sheet:
http://www.nextcoupons.com/php_parse/Or ... 192007.xls
And here's the result of my code which shows there is only one line break, which doesn't make sense as there's several rows in the .xls file:
http://www.nextcoupons.com/php_parse/pa ... ormics.php
Anyone know how I should parse this file?
Thanks in advance
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I have a php script that runs through a .xls file (which actually is saved as excel but I believe is a tab delimited .csv file). It was working for a bit but for some reason no longer is parsing it correctly.Basically I want to create an array with items in the array being rows of the .xls sheet. To do that I use an explode and set the delimiter to be a line break \r. It seems that the line breaks aren't getting picked up. Here's the code:Code: Select all
<?php
$the_file_to_parse = 'OrangeLinks_07192007.xls';
//PARSE FILE
$fd = fopen ($the_file_to_parse, "r");
$contents = fread ($fd,filesize ($the_file_to_parse));
fclose ($fd);
$delimiter = '\r';
$splitcontents = explode($delimiter, $contents);
echo 'Num of breaks: '.substr_count($content,$delimiter);
echo '<br><br>Contents of .xls:<br>'.$contents;
?>http://www.nextcoupons.com/php_parse/Or ... 192007.xls
And here's the result of my code which shows there is only one line break, which doesn't make sense as there's several rows in the .xls file:
http://www.nextcoupons.com/php_parse/pa ... ormics.php
Anyone know how I should parse this file?
Thanks in advance
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]