Source for file CSV.php
Documentation is available at CSV.php
* Copyright (c) 2006 - 2009 PHPExcel
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* @package PHPExcel_Reader
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 1.6.5, 2009-01-05
require_once 'PHPExcel.php';
/** PHPExcel_Reader_IReader */
require_once 'PHPExcel/Reader/IReader.php';
/** PHPExcel_Worksheet */
require_once 'PHPExcel/Worksheet.php';
require_once 'PHPExcel/Cell.php';
* @package PHPExcel_Reader
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
* Create a new PHPExcel_Reader_CSV
* Loads PHPExcel from file
* @param string $pFilename
public function load($pFilename)
// Load into this instance
* Loads PHPExcel from file into PHPExcel instance
* @param string $pFilename
* @param PHPExcel $objPHPExcel
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
while ($objPHPExcel->getSheetCount() <= $this->_sheetIndex) {
$objPHPExcel->createSheet();
$objPHPExcel->setActiveSheetIndex( $this->_sheetIndex );
$fileHandle = fopen($pFilename, 'r');
if ($fileHandle === false) {
throw new Exception("Could not open file $pFilename for reading.");
$rowDataCount = count($rowData);
for ($i = 0; $i < $rowDataCount; ++ $i) {
if ($rowData[$i] != '') {
$objPHPExcel->getActiveSheet()->setCellValue(
* @param string $pValue Delimiter, defaults to ,
* @param string $pValue Enclosure, defaults to "
* @param string $pValue Line ending, defaults to OS line ending (PHP_EOL)
* @param int $pValue Sheet index
|