Skip to content

Instantly share code, notes, and snippets.

@fornext1119
Created April 11, 2012 13:54
Show Gist options
  • Save fornext1119/2359444 to your computer and use it in GitHub Desktop.
Save fornext1119/2359444 to your computer and use it in GitHub Desktop.
PHP で Excel のシート名一覧を出力
<?php
// EXCELのインスタンス作成
$excelApp = new COM("Excel.Application"); # or die;
$excelApp->Visible = 1;
$excelApp->DisplayAlerts = 0; #警告メッセージをOFF
#ブックを読み取り専用で開く
$book = $excelApp->Workbooks->Open($argv[1], false, true);
foreach ($book->Worksheets as $sheet)
{
echo $sheet->Name, "\n";
}
$book->Close();
$excelApp->Quit();
unset($excelApp);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment