From: "I am on the top of the world! Borlange University" on
i have a problem of reading values from excel file via
spreadsheet_excel_reader which is a php class used to manipulate excel
files.

$data = new Spreadsheet_Excel_Reader();
$data->setOutputEncoding('CP936');
$data->read("d:\\tmp.xls");
$rows=$data->sheets[0]['numRows'];
$cell = $data->sheets[0]['cells'][1][1];

if i type many rows,say 1000, in the tmp.xls, it can read, $rows shows 1000,
however, 1000 rows of data are copied from another excel file and these
cells may have different background or other changes that differ from normal
cells, it fails to read.the variable $rows shows nothing....what i can do
now is to split these data into small groups, small enough to be read, it
really takes plenty of time.


i dont know why, has somebody met this problem ever?
From: Ashley Sheridan on
On Tue, 2010-03-16 at 20:16 +0800, I am on the top of the world!
Borlange University wrote:

> i have a problem of reading values from excel file via
> spreadsheet_excel_reader which is a php class used to manipulate excel
> files.
>
> $data = new Spreadsheet_Excel_Reader();
> $data->setOutputEncoding('CP936');
> $data->read("d:\\tmp.xls");
> $rows=$data->sheets[0]['numRows'];
> $cell = $data->sheets[0]['cells'][1][1];
>
> if i type many rows,say 1000, in the tmp.xls, it can read, $rows shows 1000,
> however, 1000 rows of data are copied from another excel file and these
> cells may have different background or other changes that differ from normal
> cells, it fails to read.the variable $rows shows nothing....what i can do
> now is to split these data into small groups, small enough to be read, it
> really takes plenty of time.
>
>
> i dont know why, has somebody met this problem ever?


If it's just the data you need, try using a csv file instead. The Excel
format is closed, and as such, the PHP classes won't have full support
for all of it's features. It seems like formatting is causing the data
to be written to the spreadsheet differently maybe.

Thanks,
Ash
http://www.ashleysheridan.co.uk


From: Jochen Schultz on
Or maybe you want to check out this:

http://www.codeplex.com/PHPExcel

I havn't checked it out for your special purpose but i found it useful
for some other jobs (especially excell 2007 support).

regards
Jochen

Ashley Sheridan schrieb:
> On Tue, 2010-03-16 at 20:16 +0800, I am on the top of the world!
> Borlange University wrote:
>
>> i have a problem of reading values from excel file via
>> spreadsheet_excel_reader which is a php class used to manipulate excel
>> files.
>>
>> $data = new Spreadsheet_Excel_Reader();
>> $data->setOutputEncoding('CP936');
>> $data->read("d:\\tmp.xls");
>> $rows=$data->sheets[0]['numRows'];
>> $cell = $data->sheets[0]['cells'][1][1];
>>
>> if i type many rows,say 1000, in the tmp.xls, it can read, $rows shows 1000,
>> however, 1000 rows of data are copied from another excel file and these
>> cells may have different background or other changes that differ from normal
>> cells, it fails to read.the variable $rows shows nothing....what i can do
>> now is to split these data into small groups, small enough to be read, it
>> really takes plenty of time.
>>
>>
>> i dont know why, has somebody met this problem ever?
>
>
> If it's just the data you need, try using a csv file instead. The Excel
> format is closed, and as such, the PHP classes won't have full support
> for all of it's features. It seems like formatting is causing the data
> to be written to the spreadsheet differently maybe.
>
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>
>

--
Sport Import GmbH - Amtsgericht Oldenburg - Tel: +49-4405-9280-63
Industriestrasse 39 - HRB 1202900 -
26188 Edewecht - GF: Michael M�llmann
From: Ashley Sheridan on
On Thu, 2010-03-18 at 19:21 +0800, I am on the top of the world!
Borlange University wrote:
> sounds good, i havnt checked out it with cvs format.
>
> thanks
>
>
> On Tue, Mar 16, 2010 at 8:15 PM, Ashley Sheridan
> <ash(a)ashleysheridan.co.uk> wrote:
>
>
> On Tue, 2010-03-16 at 20:16 +0800, I am on the top of the
> world! Borlange University wrote:
>
> > i have a problem of reading values from excel file via
> > spreadsheet_excel_reader which is a php class used to manipulate excel
> > files.
> >
> > $data = new Spreadsheet_Excel_Reader();
> > $data->setOutputEncoding('CP936');
> > $data->read("d:\\tmp.xls");
> > $rows=$data->sheets[0]['numRows'];
> > $cell = $data->sheets[0]['cells'][1][1];
> >
> > if i type many rows,say 1000, in the tmp.xls, it can read, $rows shows 1000,
> > however, 1000 rows of data are copied from another excel file and these
> > cells may have different background or other changes that differ from normal
> > cells, it fails to read.the variable $rows shows nothing....what i can do
> > now is to split these data into small groups, small enough to be read, it
> > really takes plenty of time.
> >
> >
> > i dont know why, has somebody met this problem ever?
>
>
>
>
> If it's just the data you need, try using a csv file instead.
> The Excel format is closed, and as such, the PHP classes won't
> have full support for all of it's features. It seems like
> formatting is causing the data to be written to the
> spreadsheet differently maybe.
>
>
>
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>
>
>
>


The .csv format is just a plain text format, so you won't get formatting
or formulas in your 'sheets' (csv is also a sheetless format) but it's
been used for years by many systems for data.

A lot of database systems will let you import csv files as well, which
is quite convenient, although you will have to make sure the csv uses
commas to delimit the data. Microsoft managed to basterdise this format
a bit as well, and lets you use tabs, spaces and all sorts of other
characters to delimit data fields. Someone obviously didn't mention to
them that the file type is 'comma separated values'!

Thanks,
Ash
http://www.ashleysheridan.co.uk


From: Ashley Sheridan on
On Thu, 2010-03-18 at 12:56 +0100, Jochen Schultz wrote:

> > Microsoft managed to basterdise this format
> > a bit as well, and lets you use tabs, spaces and all sorts of other
> > characters to delimit data fields. Someone obviously didn't mention to
> > them that the file type is 'comma separated values'!
>
> Or maybe it is because someone told them, that there is data out there,
> that might contain commas?
>
> regards
> Jochen


The csv format allows for quote marks which can serve to escape commas:

"data, with commas"

And for escaping quote marks, you just use triple quote marks:

"some text """with quotes""" "

Thanks,
Ash
http://www.ashleysheridan.co.uk