Created
June 1, 2016 14:52
-
-
Save hidenorigoto/0e41d518fff292f42d996bde88b05039 to your computer and use it in GitHub Desktop.
PHPExcelでシート名を取得
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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