【问题标题】:Print an entire column from an Excel Sheet using PERL使用 PERL 从 Excel 工作表打印整列
【发布时间】:2014-01-13 13:37:03
【问题描述】:

我正在尝试阅读 Excel 工作表并使用 perl 脚本打印一整列。 我只能阅读一行,我无法用我的脚本阅读脚本。 这是我的代码:-

#!/usr/bin/perl
use strict;
use warnings;
use strict;
use Data::Dumper;
use Spreadsheet::Read;

my $read = ReadData("RFQ15399_out.xlsx");
my $sheet = $read->[2];
my @row = Spreadsheet::Read::row($sheet,4);
print Dumper @row;

我的想法不多了。谁能帮助我如何使用 Spreadsheet::Read 阅读和打印列。 谢谢

【问题讨论】:

    标签: excel perl


    【解决方案1】:

    要使用 Spreadsheet::Read 打印列,请获取所需的工作表,遍历该工作表中的所有行,然后打印出每一行的列:

    foreach my $row (1..$read->[2]{maxrow}) {
    
        # Assuming you want to print out the 'D' column
        # Change 4 to something else for different columns
        print $read->[2]{cell}[$row][4] 
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-08-02
      • 1970-01-01
      • 2012-10-02
      • 2010-10-21
      相关资源
      最近更新 更多