Excel 파일 (xlsx 또는 xls 일 수 있음)에서 데이터를 구문 분석하려고합니다.Spreadsheet :: Read를 사용하여 perl에서 Excel 파일을 반복합니다.
내가 얻고 자하는 워크 시트는 이미 알고 있으므로, 반복하여 반복하여 데이터를 추출하고 싶습니다.
는내 코드 :
Can't call method "row_range" on unblessed reference at perl/parse_test.pl line 22.
내가 펄 매우 새로 온 사람, 아직 해시, 배열과 참조의 복잡성을 이해하지 못하는 그러나
#!/usr/bin/perl -w
use strict;
use warnings;
use Spreadsheet::Read;
use Getopt::Long;
my $inputfile;
GetOptions (
'i=s' => \$inputfile,
);
die 'missing input file' unless $inputfile;
my $workbook = ReadData ($inputfile, debug => 9);
my @worksheets = (1);
foreach (@worksheets) {
my $sheet = $workbook->[$_-1];
next unless $sheet;
my ($row_min, $row_max) = $sheet->row_range();
my ($col_min, $col_max) = $sheet->col_range();
for my $row ($row_min .. $row_max) {
}
}
, 나는 다음을 얻을 .
@sheet->row_range
당신은 아닌 객체의 메소드를 사용할 수 없습니다
명령 줄'-w' 옵션보다 항상'경고 사용'을 사용하십시오. 둘 다 사용하는 것은 불필요합니다. – Borodin
@ 보 로딘 : 팁 주셔서 감사! –