通常の (バイナリ) Excel ファイルは、Spreadsheet::ParseExcel
.
ただし、HTML 形式のファイルがあります。
<html xmlns:x="urn:schemas-microsoft-com:office:excel">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=windows-1252">
<!--[if gte mso 9]>
<xml>
<x:ExcelWorkbook>
<x:ExcelWorksheets>
<x:ExcelWorksheet>
<x:Name>Holdings</x:Name>
<x:WorksheetOptions>
一般的な HTML ファイル (TreeBuilder など) として手動で解析する以外に、スプレッドシートなどのファイルを解析してアクセスできる CPAN モジュールはあります Spreadsheet::ParseExcel
か?
モジュールが機能しない場所は次のとおりです。
#!/usr/local/bin/perl
use strict; use warnings;
use Spreadsheet::ParseExcel;
my $parser = Spreadsheet::ParseExcel->new();
my $file = 'file1.xls';
my $workbook;
eval {$workbook = $parser->Parse($file);};
#($Workbook returned here is ‘undef’)