.\" Automatically generated by Pod::Man 4.07 (Pod::Simple 3.32) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .if !\nF .nr F 0 .if \nF>0 \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} .\} .\" ======================================================================== .\" .IX Title "Read 3pm" .TH Read 3pm "2016-12-22" "perl v5.24.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" .Vb 1 \& Spreadsheet::Read \- Read the data from a spreadsheet .Ve .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 7 \& use Spreadsheet::Read; \& my $book = ReadData ("test.csv", sep => ";"); \& my $book = ReadData ("test.sxc"); \& my $book = ReadData ("test.ods"); \& my $book = ReadData ("test.xls"); \& my $book = ReadData ("test.xlsx"); \& my $book = ReadData ($fh, parser => "xls"); \& \& Spreadsheet::Read::add ($book, "sheet.csv"); \& \& my $sheet = $book\->[1]; # first datasheet \& my $cell = $book\->[1]{A3}; # content of field A3 of sheet 1 \& my $cell = $book\->[1]{cell}[1][3]; # same, unformatted \& \& # OO API \& my $book = Spreadsheet::Read\->new ("file.csv"); \& $book\->add ("test.xls"); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" Spreadsheet::Read tries to transparently read *any* spreadsheet and return its content in a universal manner independent of the parsing module that does the actual spreadsheet scanning. .PP For OpenOffice and/or LibreOffice this module uses Spreadsheet::ReadSXC .PP For Microsoft Excel this module uses Spreadsheet::ParseExcel , Spreadsheet::ParseXLSX , or Spreadsheet::XLSX (discouraged). .PP For \s-1CSV\s0 this module uses Text::CSV_XS or Text::CSV_PP . .PP For SquirrelCalc there is a very simplistic built-in parser .SS "Data structure" .IX Subsection "Data structure" The data is returned as an array reference: .PP .Vb 10 \& $book = [ \& # Entry 0 is the overall control hash \& { sheets => 2, \& sheet => { \& "Sheet 1" => 1, \& "Sheet 2" => 2, \& }, \& parsers => [ { \& type => "xls", \& parser => "Spreadsheet::ParseExcel", \& version => 0.59, \& }], \& error => undef, \& }, \& # Entry 1 is the first sheet \& { parser => 0, \& label => "Sheet 1", \& maxrow => 2, \& maxcol => 4, \& cell => [ undef, \& [ undef, 1 ], \& [ undef, undef, undef, undef, undef, "Nugget" ], \& ], \& attr => [], \& merged => [], \& A1 => 1, \& B5 => "Nugget", \& }, \& # Entry 2 is the second sheet \& { parser => 0, \& label => "Sheet 2", \& : \& : .Ve .PP To keep as close contact to spreadsheet users, row and column 1 have index 1 too in the \f(CW\*(C`cell\*(C'\fR element of the sheet hash, so cell \*(L"A1\*(R" is the same as \f(CW\*(C`cell\*(C'\fR [1, 1] (column first). To switch between the two, there are two helper functions available: \f(CW\*(C`cell2cr ()\*(C'\fR and \f(CW\*(C`cr2cell ()\*(C'\fR. .PP The \f(CW\*(C`cell\*(C'\fR hash entry contains unformatted data, while the hash entries with the traditional labels contain the formatted values (if applicable). .PP The control hash (the first entry in the returned array ref), contains some spreadsheet meta-data. The entry \f(CW\*(C`sheet\*(C'\fR is there to be able to find the sheets when accessing them by name: .PP .Vb 1 \& my %sheet2 = %{$book\->[$book\->[0]{sheet}{"Sheet 2"}]}; .Ve .SS "Functions and methods" .IX Subsection "Functions and methods" \fInew\fR .IX Subsection "new" .PP .Vb 1 \& my $book = Spreadsheet::Read\->new (...); .Ve .PP All options accepted by ReadData are accepted by new. .PP \fIReadData\fR .IX Subsection "ReadData" .PP .Vb 1 \& my $book = ReadData ($source [, option => value [, ... ]]); \& \& my $book = ReadData ("file.csv", sep => \*(Aq,\*(Aq, quote => \*(Aq"\*(Aq); \& \& my $book = ReadData ("file.xls", dtfmt => "yyyy\-mm\-dd"); \& \& my $book = ReadData ("file.ods"); \& \& my $book = ReadData ("file.sxc"); \& \& my $book = ReadData ("content.xml"); \& \& my $book = ReadData ($content); \& \& my $book = ReadData ($fh, parser => "xls"); .Ve .PP Tries to convert the given file, string, or stream to the data structure described above. .PP Processing Excel data from a stream or content is supported through a File::Temp temporary file or IO::Scalar when available. .PP Spreadsheet::ReadSXC does preserve sheet order as of version 0.20. .PP Currently supported options are: .IP "parser" 2 .IX Xref "parser" .IX Item "parser" Force the data to be parsed by a specific format. Possible values are \&\f(CW\*(C`csv\*(C'\fR, \f(CW\*(C`prl\*(C'\fR (or \f(CW\*(C`perl\*(C'\fR), \f(CW\*(C`sc\*(C'\fR (or \f(CW\*(C`squirelcalc\*(C'\fR), \f(CW\*(C`sxc\*(C'\fR (or \f(CW\*(C`oo\*(C'\fR, \&\f(CW\*(C`ods\*(C'\fR, \f(CW\*(C`openoffice\*(C'\fR, \f(CW\*(C`libreoffice\*(C'\fR) \f(CW\*(C`xls\*(C'\fR (or \f(CW\*(C`excel\*(C'\fR), and \f(CW\*(C`xlsx\*(C'\fR (or \f(CW\*(C`excel2007\*(C'\fR). .Sp When parsing streams, instead of files, it is highly recommended to pass this option. .Sp Spreadsheet::Read supports several underlying parsers per spreadsheet type. It will try those from most favored to least favored. When you have a good reason to prefer a different parser, you can set that in environment variables. The other options then will not be tested for: .Sp .Vb 1 \& env SPREADSHEET_READ_CSV=Text::CSV_PP ... .Ve .IP "cells" 2 .IX Xref "cells" .IX Item "cells" Control the generation of named cells ("\f(CW\*(C`A1\*(C'\fR" etc). Default is true. .IP "rc" 2 .IX Item "rc" Control the generation of the {cell}[c][r] entries. Default is true. .IP "attr" 2 .IX Item "attr" Control the generation of the {attr}[c][r] entries. Default is false. See \*(L"Cell Attributes\*(R" below. .IP "clip" 2 .IX Item "clip" If set, \f(CW\*(C`ReadData\*(C'\fR will remove all trailing rows and columns per sheet that have no visual data. If a sheet has no data at all, the sheet will be skipped entirely when this attribute is true. .Sp This option is only valid if \f(CW\*(C`cells\*(C'\fR is true. The default value is true if \f(CW\*(C`cells\*(C'\fR is true, and false otherwise. .IP "strip" 2 .IX Item "strip" If set, \f(CW\*(C`ReadData\*(C'\fR will remove trailing\- and/or leading-whitespace from every field. .Sp .Vb 6 \& strip leading strailing \& \-\-\-\-\- \-\-\-\-\-\-\- \-\-\-\-\-\-\-\-\- \& 0 n/a n/a \& 1 strip n/a \& 2 n/a strip \& 3 strip strip .Ve .IP "sep" 2 .IX Item "sep" Set separator for \s-1CSV.\s0 Default is comma \f(CW\*(C`,\*(C'\fR. .IP "quote" 2 .IX Item "quote" Set quote character for \s-1CSV.\s0 Default is \f(CW\*(C`"\*(C'\fR. .IP "dtfmt" 2 .IX Item "dtfmt" Set the format for MS-Excel date fields that are set to use the default date format. The default format in Excel is "\f(CW\*(C`m\-d\-yy\*(C'\fR\*(L", which is both not year 2000 safe, nor very useful. The default is now \*(R"\f(CW\*(C`yyyy\-mm\-dd\*(C'\fR", which is more ISO-like. .Sp Note that date formatting in MS-Excel is not reliable at all, as it will store/replace/change the date field separator in already stored formats if you change your locale settings. So the above mentioned default can be either "\f(CW\*(C`m\-d\-yy\*(C'\fR\*(L" \s-1OR \*(R"\s0\f(CW\*(C`m/d/yy\*(C'\fR" depending on what that specific character happened to be at the time the user saved the file. .IP "debug" 2 .IX Item "debug" Enable some diagnostic messages to \s-1STDERR.\s0 .Sp The value determines how much diagnostics are dumped (using Data::Peek ). A value of \f(CW9\fR and higher will dump the entire structure from the back-end parser. .PP All other attributes/options will be passed to the underlying parser if that parser supports attributes. .PP \fIcr2cell\fR .IX Subsection "cr2cell" .PP .Vb 1 \& my $cell = cr2cell (col, row); \& \& my $cell = $book\->cr2cell (col, row); # OO .Ve .PP \&\f(CW\*(C`cr2cell ()\*(C'\fR converts a \f(CW\*(C`(column, row)\*(C'\fR pair (1 based) to the traditional cell notation: .PP .Vb 2 \& my $cell = cr2cell ( 4, 14); # $cell now "D14" \& my $cell = cr2cell (28, 4); # $cell now "AB4" .Ve .PP \fIcell2cr\fR .IX Subsection "cell2cr" .PP .Vb 1 \& my ($col, $row) = cell2cr ($cell); \& \& my ($col, $row) = $book\->cell2cr ($cell); # OO .Ve .PP \&\f(CW\*(C`cell2cr ()\*(C'\fR converts traditional cell notation to a \f(CW\*(C`(column, row)\*(C'\fR pair (1 based): .PP .Vb 2 \& my ($col, $row) = cell2cr ("D14"); # returns ( 4, 14) \& my ($col, $row) = cell2cr ("AB4"); # returns (28, 4) .Ve .PP \fIrow\fR .IX Subsection "row" .PP .Vb 1 \& my @row = row ($sheet, $row) \& \& my @row = Spreadsheet::Read::row ($book\->[1], 3); \& \& my @row = $book\->row ($sheet, $row); # OO .Ve .PP Get full row of formatted values (like \f(CW\*(C`$sheet\->{A3} .. $sheet\->{G3}\*(C'\fR) .PP Note that the indexes in the returned list are 0\-based. .PP \&\f(CW\*(C`row ()\*(C'\fR is not imported by default, so either specify it in the use argument list, or call it fully qualified. .PP \fIcellrow\fR .IX Subsection "cellrow" .PP .Vb 1 \& my @row = cellrow ($sheet, $row); \& \& my @row = Spreadsheet::Read::cellrow ($book\->[1], 3); \& \& my @row = $book\->cellrow ($sheet, $row); # OO .Ve .PP Get full row of unformatted values (like \f(CW\*(C`$sheet\->{cell}[1][3] .. $sheet\->{cell}[7][3]\*(C'\fR) .PP Note that the indexes in the returned list are 0\-based. .PP \&\f(CW\*(C`cellrow ()\*(C'\fR is not imported by default, so either specify it in the use argument list, or call it fully qualified or as method call. .PP \fIrows\fR .IX Subsection "rows" .PP .Vb 1 \& my @rows = rows ($sheet); \& \& my @rows = Spreadsheet::Read::rows ($book\->[1]); \& \& my @rows = $book\->rows (1); # OO .Ve .PP Convert \f(CW\*(C`{cell}\*(C'\fR's \f(CW\*(C`[column][row]\*(C'\fR to a \f(CW\*(C`[row][column]\*(C'\fR list. .PP Note that the indexes in the returned list are 0\-based, where the index in the \f(CW\*(C`{cell}\*(C'\fR entry is 1\-based. .PP \&\f(CW\*(C`rows ()\*(C'\fR is not imported by default, so either specify it in the use argument list, or call it fully qualified. .PP \fIparses\fR .IX Subsection "parses" .PP .Vb 1 \& parses ($format); \& \& Spreadsheet::Read::parses ("CSV"); \& \& $book\->parses ("CSV"); # OO .Ve .PP \&\f(CW\*(C`parses ()\*(C'\fR returns Spreadsheet::Read's capability to parse the required format. \f(CW\*(C`ReadData\*(C'\fR will pick its preferred parser for that format unless overruled. See \f(CW\*(C`parser\*(C'\fR. .PP \&\f(CW\*(C`parses ()\*(C'\fR is not imported by default, so either specify it in the use argument list, or call it fully qualified. .PP \fIVersion\fR .IX Subsection "Version" .PP .Vb 1 \& my $v = Version () \& \& my $v = Spreadsheet::Read::Version () \& \& my $v = Spreadsheet::Read\->VERSION; \& \& my $v = $book\->Version (); # OO .Ve .PP Returns the current version of Spreadsheet::Read. .PP \&\f(CW\*(C`Version ()\*(C'\fR is not imported by default, so either specify it in the use argument list, or call it fully qualified. .PP This function returns exactly the same as \f(CW\*(C`Spreadsheet::Read\->VERSION\*(C'\fR returns and is only kept for backward compatibility reasons. .PP \fIsheets\fR .IX Subsection "sheets" .PP .Vb 2 \& my $sheets = $book\->sheets; # OO \& my @sheets = $book\->sheets; # OO .Ve .PP In scalar context return the number of sheets in the book. In list context return the labels of the sheets in the book. .PP \fIsheet\fR .IX Subsection "sheet" .PP .Vb 2 \& my $sheet = $book\->sheet (1); # OO \& my $sheet = $book\->sheet ("Foo"); # OO .Ve .PP Return the numbered or named sheet out of the book. Will return \f(CW\*(C`undef\*(C'\fR if there is no match. Will not work for sheets \fInamed\fR with a number between 1 and the number of sheets in the book. .PP If defined, the returned sheet will be of class \f(CW\*(C`Spreadsheet::Read::Sheet\*(C'\fR. .PP \fIadd\fR .IX Subsection "add" .PP .Vb 2 \& my $book = ReadData ("file.csv"); \& Spreadsheet::Read::add ($book, "file.xlsx"); \& \& my $book = Spreadsheet::Read\->new ("file.csv"); \& $book\->add ("file.xlsx"); # OO .Ve .SS "Methods on sheets" .IX Subsection "Methods on sheets" \fImaxcol\fR .IX Subsection "maxcol" .PP .Vb 1 \& my $col = $sheet\->maxcol; .Ve .PP Return the index of the last in-use column in the sheet. .PP \fImaxrow\fR .IX Subsection "maxrow" .PP .Vb 1 \& my $row = $sheet\->maxrow; .Ve .PP Return the index of the last in-use row in the sheet. .PP \fIcell\fR .IX Subsection "cell" .PP .Vb 2 \& my $cell = $sheet\->cell ("A3"); \& my $cell = $sheet\->cell (1, 3); .Ve .PP Return the value for a cell. Using tags will return the formatted value, using column and row will return unformatted value. .PP \fIcr2cell\fR .IX Subsection "cr2cell" .PP .Vb 1 \& my $cell = $sheet\->cr2cell (col, row); .Ve .PP \&\f(CW\*(C`cr2cell ()\*(C'\fR converts a \f(CW\*(C`(column, row)\*(C'\fR pair (1 based) to the traditional cell notation: .PP .Vb 2 \& my $cell = $sheet\->cr2cell ( 4, 14); # $cell now "D14" \& my $cell = $sheet\->cr2cell (28, 4); # $cell now "AB4" .Ve .PP \fIcell2cr\fR .IX Subsection "cell2cr" .PP .Vb 1 \& my ($col, $row) = $sheet\->cell2cr ($cell); .Ve .PP \&\f(CW\*(C`cell2cr ()\*(C'\fR converts traditional cell notation to a \f(CW\*(C`(column, row)\*(C'\fR pair (1 based): .PP .Vb 2 \& my ($col, $row) = $sheet\->cell2cr ("D14"); # returns ( 4, 14) \& my ($col, $row) = $sheet\->cell2cr ("AB4"); # returns (28, 4) .Ve .PP \fIrow\fR .IX Subsection "row" .PP .Vb 1 \& my @row = $sheet\->row ($row); .Ve .PP Get full row of formatted values (like \f(CW\*(C`$sheet\->{A3} .. $sheet\->{G3}\*(C'\fR) .PP Note that the indexes in the returned list are 0\-based. .PP \fIcellrow\fR .IX Subsection "cellrow" .PP .Vb 1 \& my @row = $sheet\->cellrow ($row); .Ve .PP Get full row of unformatted values (like \f(CW\*(C`$sheet\->{cell}[1][3] .. $sheet\->{cell}[7][3]\*(C'\fR) .PP Note that the indexes in the returned list are 0\-based. .PP \fIrows\fR .IX Subsection "rows" .PP .Vb 1 \& my @rows = $sheet\->rows (); .Ve .PP Convert \f(CW\*(C`{cell}\*(C'\fR's \f(CW\*(C`[column][row]\*(C'\fR to a \f(CW\*(C`[row][column]\*(C'\fR list. .PP Note that the indexes in the returned list are 0\-based, where the index in the \f(CW\*(C`{cell}\*(C'\fR entry is 1\-based. .SS "Using \s-1CSV\s0" .IX Subsection "Using CSV" In case of \s-1CSV\s0 parsing, \f(CW\*(C`ReadData\*(C'\fR will use the first line of the file to auto-detect the separation character if the first argument is a file and both \f(CW\*(C`sep\*(C'\fR and \f(CW\*(C`quote\*(C'\fR are not passed as attributes. Text::CSV_XS (or Text::CSV_PP ) is able to automatically detect and use \f(CW\*(C`\er\*(C'\fR line endings. .PP \&\s-1CSV\s0 can parse streams too, but be sure to pass \f(CW\*(C`sep\*(C'\fR and/or \f(CW\*(C`quote\*(C'\fR if these do not match the default \f(CW\*(C`,\*(C'\fR and \f(CW\*(C`"\*(C'\fR. .PP When an error is found in the \s-1CSV,\s0 it is automatically reported (to \s-1STDERR\s0). The structure will store the error in \f(CW\*(C`$ss\->[0]{error}\*(C'\fR as anonymous list returned by \&\f(CW\*(C`$csv\->error_diag\*(C'\fR . See Text::CSV_XS for documentation. .PP .Vb 2 \& my $ss = ReadData ("bad.csv"); \& $ss\->[0]{error} and say $ss\->[0]{error}[1]; .Ve .SS "Cell Attributes" .IX Xref "merged" .IX Subsection "Cell Attributes" If the constructor was called with \f(CW\*(C`attr\*(C'\fR having a true value, effort is made to analyze and store field attributes like this: .PP .Vb 10 \& { label => "Sheet 1", \& maxrow => 5, \& maxcol => 2, \& cell => [ undef, \& [ undef, 1 ], \& [ undef, undef, undef, undef, undef, "Nugget" ], \& ], \& attr => [ undef, \& [ undef, { \& type => "numeric", \& fgcolor => "#ff0000", \& bgcolor => undef, \& font => "Arial", \& size => undef, \& format => "## ##0.00", \& halign => "right", \& valign => "top", \& uline => 0, \& bold => 0, \& italic => 0, \& wrap => 0, \& merged => 0, \& hidden => 0, \& locked => 0, \& enc => "utf\-8", \& }, ] \& [ undef, undef, undef, undef, undef, { \& type => "text", \& fgcolor => "#e2e2e2", \& bgcolor => undef, \& font => "Letter Gothic", \& size => 15, \& format => undef, \& halign => "left", \& valign => "top", \& uline => 0, \& bold => 0, \& italic => 0, \& wrap => 0, \& merged => 0, \& hidden => 0, \& locked => 0, \& enc => "iso8859\-1", \& }, ] \& merged => [], \& A1 => 1, \& B5 => "Nugget", \& }, .Ve .PP This has now been partially implemented, mainly for Excel, as the other parsers do not (yet) support all of that. \s-1YMMV.\s0 .PP If a cell itself is not hidden, but the parser holds the information that either the row or the column (or both) the field is in is hidden, the flag is inherited into the cell attributes. .PP \fIMerged cells\fR .IX Subsection "Merged cells" .PP Note that only Spreadsheet::ReadSXC documents the use of merged cells, and not in a way useful for the spreadsheet consumer. .PP \&\s-1CSV\s0 does not support merged cells (though future implementations of \s-1CSV\s0 for the web might). .PP The documentation of merged areas in Spreadsheet::ParseExcel and Spreadsheet::ParseXLSX can be found in Spreadsheet::ParseExcel::Worksheet and Spreadsheet::ParseExcel::Cell . .PP None of basic Spreadsheet::XLSX , Spreadsheet::ParseExcel , and Spreadsheet::ParseXLSX manual pages mention merged cells at all. .PP This module just tries to return the information in a generic way. .PP Given this spreadsheet as an example .PP .Vb 1 \& merged.xlsx: \& \& A B C \& +\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-+ \& 1| | foo | \& +\-\-\-\-\-+ + \& 2| bar | | \& | +\-\-\-\-\-+\-\-\-\-\-+ \& 3| | urg | orc | \& +\-\-\-\-\-+\-\-\-\-\-+\-\-\-\-\-+ .Ve .PP the information extracted from that undocumented information is returned in the \f(CW\*(C`merged\*(C'\fR entry of the sheet's hash as a list of top-left, bottom-right coordinate pars (col, row, col, row). For given example, that would be: .PP .Vb 4 \& $ss\->{merged} = [ \& [ 1, 2, 1, 3 ], # A2\-A3 \& [ 2, 1, 3, 2 ], # B1\-C2 \& ]; .Ve .PP When the attributes are also enabled, there is some merge information copied directly from the cell information, but again, that stems from code analysis and not from documentation: .PP .Vb 9 \& my $ss = ReadData ("merged.xlsx", attr => 1)\->[1]; \& foreach my $row (1 .. $ss\->{maxrow}) { \& foreach my $col (1 .. $ss\->{maxcol}) { \& my $cell = cr2cell ($col, $row); \& printf "%s %\-3s %d ", $cell, $ss\->{$cell}, \& $ss\->{attr}[$col][$row]{merged}; \& } \& print "\en"; \& } \& \& A1 0 B1 foo 1 C1 1 \& A2 bar 1 B2 1 C2 1 \& A3 1 B3 urg 0 C3 orc 0 .Ve .PP In this example, there is no way to see if \f(CW\*(C`B2\*(C'\fR is merged to \f(CW\*(C`A2\*(C'\fR or to \f(CW\*(C`B1\*(C'\fR without analyzing all surrounding cells. This could as well mean \f(CW\*(C`A2:A3\*(C'\fR, \f(CW\*(C`B1:C1\*(C'\fR, \f(CW\*(C`B2:C2\*(C'\fR, as \f(CW\*(C`A2:A3\*(C'\fR, \f(CW\*(C`B1:B2\*(C'\fR, \f(CW\*(C`C1:C2\*(C'\fR, as \&\f(CW\*(C`A2:A3\*(C'\fR, \f(CW\*(C`B1:C2\*(C'\fR. Use the \f(CW\*(C`merged\*(C'\fR entry described above to find out what fields are merged to what other fields. .SH "TOOLS" .IX Header "TOOLS" This modules comes with a few tools that perform tasks from the \s-1FAQ,\s0 like \&\*(L"How do I select only column D through F from sheet 2 into a \s-1CSV\s0 file?\*(R" .PP If the module was installed without the tools, you can find them here: https://github.com/Tux/Spreadsheet\-Read/tree/master/examples .ie n .SS """xlscat""" .el .SS "\f(CWxlscat\fP" .IX Subsection "xlscat" Show (parts of) a spreadsheet in plain text, \s-1CSV,\s0 or \s-1HTML\s0 .PP .Vb 10 \& usage: xlscat [\-s ] [\-L] [\-n] [\-A] [\-u] [Selection] file.xls \& [\-c | \-m] [\-u] [Selection] file.xls \& \-i [\-S sheets] file.xls \& Generic options: \& \-v[#] Set verbose level (xlscat/xlsgrep) \& \-d[#] Set debug level (Spreadsheet::Read) \& \-u Use unformatted values \& \-\-noclip Do not strip empty sheets and \& trailing empty rows and columns \& \-e Set encoding for input and output \& \-b Set encoding for input \& \-a Set encoding for output \& Input CSV: \& \-\-in\-sep=c Set input sep_char for CSV \& Input XLS: \& \-\-dtfmt=fmt Specify the default date format to replace \*(Aqm\-d\-yy\*(Aq \& the default replacement is \*(Aqyyyy\-mm\-dd\*(Aq \& Output Text (default): \& \-s Use separator . Default \*(Aq|\*(Aq, \en allowed \& \-L Line up the columns \& \-n [skip] Number lines (prefix with column number) \& optionally skip (header) lines \& \-A Show field attributes in ANSI escapes \& \-h[#] Show # header lines \& Output Index only: \& \-i Show sheet names and size only \& Output CSV: \& \-c Output CSV, separator = \*(Aq,\*(Aq \& \-m Output CSV, separator = \*(Aq;\*(Aq \& Output HTML: \& \-H Output HTML \& Selection: \& \-S Only print sheets . \*(Aqall\*(Aq is a valid set \& Default only prints the first sheet \& \-R Only print rows . Default is \*(Aqall\*(Aq \& \-C Only print columns . Default is \*(Aqall\*(Aq \& \-F Only fields e.g. \-FA3,B16 \& Ordering (column numbers in result set *after* selection): \& \-\-sort=spec Sort output (e.g. \-\-sort=3,2r,5n,1rn+2) \& +# \- first # lines do not sort (header) \& # \- order on column # lexical ascending \& #n \- order on column # numeric ascending \& #r \- order on column # lexical descending \& #rn \- order on column # numeric descending .Ve .ie n .SS """xlsgrep""" .el .SS "\f(CWxlsgrep\fP" .IX Subsection "xlsgrep" Show (parts of) a spreadsheet that match a pattern in plain text, \s-1CSV,\s0 or \s-1HTML\s0 .PP .Vb 10 \& usage: xlsgrep [\-s ] [\-L] [\-n] [\-A] [\-u] [Selection] pattern file.xls \& [\-c | \-m] [\-u] [Selection] pattern file.xls \& \-i [\-S sheets] pattern file.xls \& Generic options: \& \-v[#] Set verbose level (xlscat/xlsgrep) \& \-d[#] Set debug level (Spreadsheet::Read) \& \-u Use unformatted values \& \-\-noclip Do not strip empty sheets and \& trailing empty rows and columns \& \-e Set encoding for input and output \& \-b Set encoding for input \& \-a Set encoding for output \& Input CSV: \& \-\-in\-sep=c Set input sep_char for CSV \& Input XLS: \& \-\-dtfmt=fmt Specify the default date format to replace \*(Aqm\-d\-yy\*(Aq \& the default replacement is \*(Aqyyyy\-mm\-dd\*(Aq \& Output Text (default): \& \-s Use separator . Default \*(Aq|\*(Aq, \en allowed \& \-L Line up the columns \& \-n [skip] Number lines (prefix with column number) \& optionally skip (header) lines \& \-A Show field attributes in ANSI escapes \& \-h[#] Show # header lines \& Grep options: \& \-i Ignore case \& \-w Match whole words only \& Output CSV: \& \-c Output CSV, separator = \*(Aq,\*(Aq \& \-m Output CSV, separator = \*(Aq;\*(Aq \& Output HTML: \& \-H Output HTML \& Selection: \& \-S Only print sheets . \*(Aqall\*(Aq is a valid set \& Default only prints the first sheet \& \-R Only print rows . Default is \*(Aqall\*(Aq \& \-C Only print columns . Default is \*(Aqall\*(Aq \& \-F Only fields e.g. \-FA3,B16 \& Ordering (column numbers in result set *after* selection): \& \-\-sort=spec Sort output (e.g. \-\-sort=3,2r,5n,1rn+2) \& +# \- first # lines do not sort (header) \& # \- order on column # lexical ascending \& #n \- order on column # numeric ascending \& #r \- order on column # lexical descending \& #rn \- order on column # numeric descending .Ve .ie n .SS """xls2csv""" .el .SS "\f(CWxls2csv\fP" .IX Subsection "xls2csv" Convert a spreadsheet to \s-1CSV.\s0 This is just a small wrapper over \f(CW\*(C`xlscat\*(C'\fR. .PP .Vb 1 \& usage: xls2csv [ \-o file.csv ] file.xls .Ve .ie n .SS """ss2tk""" .el .SS "\f(CWss2tk\fP" .IX Subsection "ss2tk" Show a spreadsheet in a perl/Tk spreadsheet widget .PP .Vb 2 \& usage: ss2tk [\-w ] [X11 options] file.xls [] \& \-w use as default column width (4) .Ve .ie n .SS """ssdiff""" .el .SS "\f(CWssdiff\fP" .IX Subsection "ssdiff" Show the differences between two spreadsheets. .PP .Vb 1 \& usage: examples/ssdiff [\-\-verbose[=1]] file.xls file.xlsx .Ve .SH "TODO" .IX Header "TODO" .IP "Options" 4 .IX Item "Options" .RS 4 .PD 0 .IP "Module Options" 2 .IX Item "Module Options" .PD New Spreadsheet::Read options are bound to happen. I'm thinking of an option that disables the reading of the data entirely to speed up an index request (how many sheets/fields/columns). See \f(CW\*(C`xlscat \-i\*(C'\fR. .IP "Parser options" 2 .IX Item "Parser options" Try to transparently support as many options as the encapsulated modules support regarding (un)formatted values, (date) formats, hidden columns rows or fields etc. These could be implemented like \f(CW\*(C`attr\*(C'\fR above but names \f(CW\*(C`meta\*(C'\fR, or just be new values in the \f(CW\*(C`attr\*(C'\fR hashes. .RE .RS 4 .RE .IP "Other spreadsheet formats" 4 .IX Item "Other spreadsheet formats" I consider adding any spreadsheet interface that offers a usable \s-1API.\s0 .IP "Alternative parsers for existing formats" 4 .IX Item "Alternative parsers for existing formats" As long as the alternative has a good reason for its existence, and the \&\s-1API\s0 of that parser reasonable fits in my approach, I will consider to implement the glue layer, or apply patches to do so as long as these match what \fI\s-1CONTRIBUTING\s0.md\fR describes. .SH "SEE ALSO" .IX Header "SEE ALSO" .IP "Text::CSV_XS, Text::CSV_PP" 2 .IX Item "Text::CSV_XS, Text::CSV_PP" See Text::CSV_XS , Text::CSV_PP , and Text::CSV documentation. .Sp Text::CSV is a wrapper over Text::CSV_XS (the fast \s-1XS\s0 version) and/or Text::CSV_PP (the pure perl version). .IP "Spreadsheet::ParseExcel" 2 .IX Item "Spreadsheet::ParseExcel" Spreadsheet::ParseExcel is the best parser for old-style Microsoft Excel (.xls) files. .IP "Spreadsheet::ParseXLSX" 2 .IX Item "Spreadsheet::ParseXLSX" Spreadsheet::ParseXLSX is like Spreadsheet::ParseExcel , but for new Microsoft Excel 2007+ files (.xlsx). They have the same \s-1API.\s0 .Sp This module uses XML::Twig to parse the internal \s-1XML.\s0 .IP "Spreadsheet::XLSX" 2 .IX Item "Spreadsheet::XLSX" See Spreadsheet::XLSX documentation. .Sp This module is dead and deprecated. It is \fBbuggy and unmaintained\fR. \fIPlease\fR use Spreadsheet::ParseXLSX instead. .IP "Spreadsheet::ReadSXC" 2 .IX Item "Spreadsheet::ReadSXC" Spreadsheet::ReadSXC is a parser for OpenOffice/LibreOffice (.sxc and .ods) spreadsheet files. .IP "Spreadsheet::BasicRead" 2 .IX Item "Spreadsheet::BasicRead" See Spreadsheet::BasicRead for xlscat-like functionality (Excel only) .IP "Spreadsheet::ConvertAA" 2 .IX Item "Spreadsheet::ConvertAA" See Spreadsheet::ConvertAA for an alternative set of \*(L"cell2cr\*(R"/\*(L"cr2cell\*(R" pair. .IP "Spreadsheet::Perl" 2 .IX Item "Spreadsheet::Perl" Spreadsheet::Perl offers a Pure Perl implementation of a spreadsheet engine. Users that want this format to be supported in Spreadsheet::Read are hereby motivated to offer patches. It is not high on my TODO-list. .IP "Spreadsheet::CSV" 2 .IX Item "Spreadsheet::CSV" Spreadsheet::CSV offers the interesting approach of seeing all supported spreadsheet formats as if it were \&\s-1CSV,\s0 mimicking the Text::CSV_XS interface. .IP "xls2csv" 2 .IX Item "xls2csv" xls2csv offers an alternative for my \&\f(CW\*(C`xlscat \-c\*(C'\fR, in the xls2csv tool, but this tool focuses on character encoding transparency, and requires some other modules. .SH "AUTHOR" .IX Header "AUTHOR" H.Merijn Brand, .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" Copyright (C) 2005\-2016 H.Merijn Brand .PP This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.