Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/perl/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Perl 电子表格::读和列_Perl - Fatal编程技术网

Perl 电子表格::读和列

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

我试图使用Perl的电子表格::Read来提取电子表格各个列中的所有数据。例如,我想提取以下列中的所有数据:

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";
}