Perl 电子表格::读和列
我试图使用Perl的电子表格::Read来提取电子表格各个列中的所有数据。例如,我想提取以下列中的所有数据:Perl 电子表格::读和列,perl,Perl,我试图使用Perl的电子表格::Read来提取电子表格各个列中的所有数据。例如,我想提取以下列中的所有数据: A1 = 'NewRecordFlag' B1 = 'AgencyName' C1 = 'CredentialIdnt' 在电子表格::读取模块中,我可以从行中提取所有数据,但如何从列中提取 在下面的示例中,下面的代码从第6行提取数据。那么,如何创建A1、B1和C1的数组呢 #!/usr/bin/perl use warnings; use strict; use Data::Pri
A1 = 'NewRecordFlag'
B1 = 'AgencyName'
C1 = 'CredentialIdnt'
在电子表格::读取模块中,我可以从行中提取所有数据,但如何从列中提取
在下面的示例中,下面的代码从第6行提取数据。那么,如何创建A1、B1和C1的数组呢
#!/usr/bin/perl
use warnings;
use strict;
use Data::Printer;
use Spreadsheet::Read qw(row rows);
use Spreadsheet::Read;
my $workbook = ReadData("test.xls");
my @row = row($workbook->[1], 6);
我能够通过电子表格::BasicReadNamedCol模块解决这个问题
#!/usr/bin/perl
use warnings;
use strict;
use Data::Dumper;
use Spreadsheet::BasicReadNamedCol;
my $xlsFileName = 'test.xls';
my @columnHeadings = (
'AgencyName',
'eMail',
'PhysicalAddress1',
'PhysicalAddress2'
);
my $ss = new Spreadsheet::BasicReadNamedCol($xlsFileName) ||
die "Could not open '$xlsFileName': $!";
$ss->setColumns(@columnHeadings);
# Print each row of the spreadsheet in the order defined in
# the columnHeadings array
my $row = 0;
while (my $data = $ss->getNextRow())
{
$row++;
print join('|', $row, @$data), "\n";
}