Skip to content

Instantly share code, notes, and snippets.

@nissuk
Created May 29, 2011 08:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nissuk/997585 to your computer and use it in GitHub Desktop.
Save nissuk/997585 to your computer and use it in GitHub Desktop.
PHPExcel: .xlsの指定したシートのデータのみ読み込む例
<?php
require_once 'PHPExcel.php';
$filename = 'Book1.xls';
$sheet_name = 'Sheet1';
$reader = PHPExcel_IOFactory::createReader('EXCEL5');
$reader->setReadDataOnly(true);
$reader->setLoadSheetsOnly(array($sheet_name));
$excel = $reader->load($filename);
$sheet = $excel->getSheet(0);
echo $sheet->getCell('A1')->getValue();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment