Skip to content

Instantly share code, notes, and snippets.

@hidenorigoto
Created June 1, 2016 14:52
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 hidenorigoto/0e41d518fff292f42d996bde88b05039 to your computer and use it in GitHub Desktop.
Save hidenorigoto/0e41d518fff292f42d996bde88b05039 to your computer and use it in GitHub Desktop.
PHPExcelでシート名を取得
<?php
require_once './vendor/autoload.php';
//Excel2007形式(xlsx)ファイルのリーダーを生成
$obj_excel_reader = PHPExcel_IOFactory::createReader("Excel2007");
//test.xlsxの読み込み
$obj_excel = $obj_excel_reader->load("test.xlsx");
//test.xlsxのシートの名称一覧を配列で取得
$ary = $obj_excel->getSheetNames();
print_r($ary);
foreach ($ary as $sheetName) {
if ($sheetName == '表紙') {
echo "!";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment