tanvir
tanvir

Reputation: 317

How to read multiple worksheets from a single .csv file?

I want to read multiple worksheets in a single .csv file using PHP. I have done it for one worksheet:

$file_handle = fopen("widgets.csv", "r");

while (!feof($file_handle) ) {
    $line_of_text = fgetcsv($file_handle, 1024);
    print $line_of_text[0] . $line_of_text[1]. $line_of_text[2] . "<BR>";
}

fclose($file_handle);

But how can I read multiple worksheets from the same .csv file?

Upvotes: 0

Views: 2957

Answers (1)

Danny Beckett
Danny Beckett

Reputation: 20838

There is no such thing as multiple sheets in .csv files.

This is something unique to .xls/.xlsx files.

.csv files contain only a single worksheet*.

* actually they don't contain any worksheets, since there is no concept of worksheets

Upvotes: 3

Related Questions