I use PHPExcel to import data from a .csv file which has the same rows and columns with a excel file. Basically I open them with LibreOffice and they look the same. However there are two result when calculating theirs worksheet dimensions.
- csv: A1:A10
- xlsx: A1: AMK10
I just want to ask that it is always like that due to the different formats or I do something wrong?
$pi = pathinfo($filePath);
switch ($pi['extension']) {
case 'xls':
$reader = PHPExcel_IOFactory::createReader('Excel5');
break;
case 'xlsx':
$reader = PHPExcel_IOFactory::createReader('Excel2007');
break;
case 'csv':
$reader = PHPExcel_IOFactory::createReader('CSV');
break;
default:
return array();
}
$phpexcel = $reader->load($filePath);
$sheet = $phpexcel->getActiveSheet();
$sheet->calculateWorksheetDimension();