tokuhirom's Blog

Spreadsheet::ParseExcel でシート名を一覧をだす

use strict;
use warnings;
use Spreadsheet::ParseExcel;
use Spreadsheet::ParseExcel::FmtJapan;

my $fname = shift or die "Usage: $0 foo.xls\n";

my $format = Spreadsheet::ParseExcel::FmtJapan->new(Code => 'sjis');
my $book = Spreadsheet::ParseExcel::Workbook->Parse($fname, $format);
for my $sheet (@{$book->{Worksheet}}) {
	print $sheet->get_name(), $/;
}