1Spreadsheet::ParseXLSX(U3s)er Contributed Perl DocumentatSiporneadsheet::ParseXLSX(3)
2
3
4
6 Spreadsheet::ParseXLSX - parse XLSX files
7
9 version 0.27
10
12 use Spreadsheet::ParseXLSX;
13
14 my $parser = Spreadsheet::ParseXLSX->new;
15 my $workbook = $parser->parse("file.xlsx");
16 # see Spreadsheet::ParseExcel for further documentation
17
19 This module is an adaptor for Spreadsheet::ParseExcel that reads XLSX
20 files. For documentation about the various data that you can retrieve
21 from these classes, please see Spreadsheet::ParseExcel,
22 Spreadsheet::ParseExcel::Workbook, Spreadsheet::ParseExcel::Worksheet,
23 and Spreadsheet::ParseExcel::Cell.
24
26 new(%opts)
27 Returns a new parser instance. Takes a hash of parameters:
28
29 Password
30 Password to use for decrypting encrypted files.
31
32 parse($file, $formatter)
33 Parses an XLSX file. Parsing errors throw an exception. $file can be
34 either a filename or an open filehandle. Returns a
35 Spreadsheet::ParseExcel::Workbook instance containing the parsed data.
36 The $formatter argument is an optional formatter class as described in
37 Spreadsheet::ParseExcel.
38
40 This module returns data using classes from Spreadsheet::ParseExcel, so
41 for the most part, it should just be a drop-in replacement. That said,
42 there are a couple areas where the data returned is intentionally
43 different:
44
45 Colors
46 In Spreadsheet::ParseExcel, colors are represented by integers
47 which index into the color table, and you have to use
48 "Spreadsheet::ParseExcel->ColorIdxToRGB" in order to get the actual
49 value out. In Spreadsheet::ParseXLSX, while the color table still
50 exists, cells are also allowed to specify their color directly
51 rather than going through the color table. In order to avoid
52 confusion, I normalize all color values in Spreadsheet::ParseXLSX
53 to their string RGB format ("#0088ff"). This affects the "Fill",
54 "BdrColor", and "BdrDiag" properties of formats, and the "Color"
55 property of fonts. Note that the default color is represented by
56 "undef" (the same thing that "ColorIdxToRGB" would return).
57
58 Formulas
59 Spreadsheet::ParseExcel doesn't support formulas.
60 Spreadsheet::ParseXLSX provides basic formula support by returning
61 the text of the formula as part of the cell data. You can access it
62 via "$cell->{Formula}". Note that the restriction still holds that
63 formula cell values aren't available unless they were explicitly
64 provided when the spreadsheet was written.
65
67 Large spreadsheets may cause segfaults on perl 5.14 and earlier
68 This module internally uses XML::Twig, which makes it potentially
69 subject to Bug #71636 for XML-Twig: Segfault with medium-sized
70 document <https://rt.cpan.org/Public/Bug/Display.html?id=71636> on
71 perl versions 5.14 and below (the underlying bug with perl weak
72 references was fixed in perl 5.15.5). The larger and more complex
73 the spreadsheet, the more likely to be affected, but the actual
74 size at which it segfaults is platform dependent. On a 64-bit perl
75 with 7.6gb memory, it was seen on spreadsheets about 300mb and
76 above. You can work around this adding XML::Twig::_set_weakrefs(0)
77 to your code before parsing the spreadsheet, although this may have
78 other consequences such as memory leaks.
79
80 Worksheets without the "dimension" tag are not supported
81 Intra-cell formatting is discarded
82 Shared formulas are not supported
83 Shared formula support will require an actual formula parser and
84 quite a bit of custom logic, since the only thing stored in the
85 document is the formula for the base cell - updating the cell
86 references in the formulas in the rest of the cells is handled by
87 the application. Values for these cells are still handled properly.
88
89 In addition, there are still a few areas which are not yet implemented
90 (the XLSX spec is quite large). If you run into any of those, bug
91 reports are quite welcome.
92
93 Please report any bugs to GitHub Issues at
94 <https://github.com/doy/spreadsheet-parsexlsx/issues>.
95
97 Spreadsheet::ParseExcel: The equivalent, for XLS files.
98
99 Spreadsheet::XLSX: An older, less robust and featureful implementation.
100
102 You can find this documentation for this module with the perldoc
103 command.
104
105 perldoc Spreadsheet::ParseXLSX
106
107 You can also look for information at:
108
109 · MetaCPAN
110
111 <https://metacpan.org/release/Spreadsheet-ParseXLSX>
112
113 · RT: CPAN's request tracker
114
115 <http://rt.cpan.org/NoAuth/Bugs.html?Dist=Spreadsheet-ParseXLSX>
116
117 · Github
118
119 <https://github.com/doy/spreadsheet-parsexlsx>
120
121 · CPAN Ratings
122
123 <http://cpanratings.perl.org/d/Spreadsheet-ParseXLSX>
124
126 Parts of this code were paid for by
127
128 Socialflow <http://socialflow.com>
129
131 Jesse Luehrs <doy@tozt.net>
132
134 This software is Copyright (c) 2016 by Jesse Luehrs.
135
136 This is free software, licensed under:
137
138 The MIT (X11) License
139
140
141
142perl v5.32.0 2020-07-28 Spreadsheet::ParseXLSX(3)