---
title: "Perl之Spreadsheet::ParseExcel"
author: "lzqustc"
date: "2017-04-06T11:37:57Z"
tags: ["Perl"]
categories: ["编程语言"]
slug: "perl-spreadsheet-parseexcel"
draft: false
lastmod: "2017-04-06T11:38:49Z"
id: 2367576
url: "https://lzqustc.iteye.com/blog/2367576"
---

转载：[http://www.alonely.com.cn/CGI-Perl/20160908/29061.html](http://www.alonely.com.cn/CGI-Perl/20160908/29061.html)

 

use strict;

use Spreadsheet::ParseExcel;

 

my $parser   = Spreadsheet::ParseExcel-&gt;new();

my $workbook = $parser-&gt;Parse('Book1.xls');

 

for my $worksheet ( $workbook-&gt;worksheets() ) {

my ( $row\_min, $row\_max ) = $worksheet-&gt;row\_range();

my ( $col\_min, $col\_max ) = $worksheet-&gt;col\_range();

 

for my $row ( $row\_min .. $row\_max ) {

for my $col ( $col\_min .. $col\_max ) {

my $cell = $worksheet-&gt;get\_cell( $row, $col );

next unless $cell;

print "Row, Col    = ($row, $col)\\n";

print "Value       = ", $cell-&gt;value(),       "\\n";

print "Unformatted = ", $cell-&gt;unformatted(), "\\n";

print "\\n";

}

}

}