0

Possible Duplicate:
Efficiently counting the number of lines of a text file. (200mb+)
How do I determine the end of the file using PHPExcel library in chunk loop?

I can't seem to get this to work in PHP

I'm trying to count the number of lines in an uploaded EXcel file

Here is what I have but it always multiplies this by two and I want to remove the first row because it is just headers, please help:

$countthelines= count(file($file)) -1;
Community
  • 1
  • 1

1 Answers1

1

Convert your Excel file to a CSV file and try something like this:

$countthelines = count(file($file, FILE_SKIP_EMPTY_LINES)) - 1;
Benjamin Paap
  • 2,744
  • 2
  • 21
  • 33