# phpman > perldoc > Spreadsheet::XLSX

## NAME
    [Spreadsheet::XLSX](https://www.chedong.com/phpMan.php/perldoc/Spreadsheet%3A%3AXLSX/markdown) - Perl extension for reading MS Excel 2007 files;

## SYNOPSIS
        use [Text::Iconv](https://www.chedong.com/phpMan.php/perldoc/Text%3A%3AIconv/markdown);
        my $converter = [Text::Iconv](https://www.chedong.com/phpMan.php/perldoc/Text%3A%3AIconv/markdown)->new("utf-8", "windows-1251");

        # [Text::Iconv](https://www.chedong.com/phpMan.php/perldoc/Text%3A%3AIconv/markdown) is not really required.
        # This can be any object with the convert method. Or nothing.

        use [Spreadsheet::XLSX](https://www.chedong.com/phpMan.php/perldoc/Spreadsheet%3A%3AXLSX/markdown);

        my $excel = [Spreadsheet::XLSX](https://www.chedong.com/phpMan.php/perldoc/Spreadsheet%3A%3AXLSX/markdown)->new('test.xlsx', $converter);

        foreach my $sheet (@{$excel->{Worksheet}}) {

            printf("Sheet: %s\n", $sheet->{Name});

            $sheet->{MaxRow} ||= $sheet->{MinRow};

            foreach my $row ($sheet->{MinRow} .. $sheet->{MaxRow}) {

                $sheet->{MaxCol} ||= $sheet->{MinCol};

                foreach my $col ($sheet->{MinCol} ..  $sheet->{MaxCol}) {

                    my $cell = $sheet->{Cells}[$row][$col];

                    if ($cell) {
                        printf("( %s , %s ) => %s\n", $row, $col, $cell->{Val});
                    }

                }

            }

        }

## DESCRIPTION
    This module is a (quick and dirty) emulation of [Spreadsheet::ParseExcel](https://www.chedong.com/phpMan.php/perldoc/Spreadsheet%3A%3AParseExcel/markdown) for Excel 2007 (.xlsx)
    file format. It supports styles and many of Excel's quirks, but not all. It populates the
    classes from [Spreadsheet::ParseExcel](https://www.chedong.com/phpMan.php/perldoc/Spreadsheet%3A%3AParseExcel/markdown) for interoperability; including Workbook, Worksheet, and
    Cell.

## SEE ALSO
    [Spreadsheet::ParseXLSX](https://www.chedong.com/phpMan.php/perldoc/Spreadsheet%3A%3AParseXLSX/markdown)
      This module has some serious issues with the way it uses regexs for parsing the XML. I would
      strongly encourage switching to [Spreadsheet::ParseXLSX](https://www.chedong.com/phpMan.php/perldoc/Spreadsheet%3A%3AParseXLSX/markdown) which takes a more reliable approach.

    [Text::CSV_XS](https://www.chedong.com/phpMan.php/perldoc/Text%3A%3ACSVXS/markdown), [Text::CSV_PP](https://www.chedong.com/phpMan.php/perldoc/Text%3A%3ACSVPP/markdown)
    [Spreadsheet::ParseExcel](https://www.chedong.com/phpMan.php/perldoc/Spreadsheet%3A%3AParseExcel/markdown)
    [Spreadsheet::ReadSXC](https://www.chedong.com/phpMan.php/perldoc/Spreadsheet%3A%3AReadSXC/markdown)
    [Spreadsheet::BasicRead](https://www.chedong.com/phpMan.php/perldoc/Spreadsheet%3A%3ABasicRead/markdown)
      for xlscat likewise functionality (Excel only)

    [Spreadsheet::ConvertAA](https://www.chedong.com/phpMan.php/perldoc/Spreadsheet%3A%3AConvertAA/markdown)
      for an alternative set of "cell2cr()" / "cr2cell()" pair

    [Spreadsheet::Perl](https://www.chedong.com/phpMan.php/perldoc/Spreadsheet%3A%3APerl/markdown)
      offers a Pure Perl implementation of a spreadsheet engine. Users that want this format to be
      supported in [Spreadsheet::Read](https://www.chedong.com/phpMan.php/perldoc/Spreadsheet%3A%3ARead/markdown) are hereby motivated to offer patches. It's not high on my
      todo-list.

    xls2csv
      <<https://metacpan.org/release/KEN/xls2csv-1.07>> offers an alternative for my "xlscat -c", in
      the xls2csv tool, but this tool focusses on character encoding transparency, and requires some
      other modules.

    [Spreadsheet::Read](https://www.chedong.com/phpMan.php/perldoc/Spreadsheet%3A%3ARead/markdown)
      read the data from a spreadsheet (interface module)

## AUTHOR
    Dmitry Ovsyanko, <<do@eludia.ru>>, <http://eludia.ru/wiki/>

    Patches by:

            Steve Simms
            Joerg Meltzer
            Loreyna Yeung
            Rob Polocz
            Gregor Herrmann
            H.Merijn Brand
            endacoe
            Pat Mariani
            Sergey Pushkin

## ACKNOWLEDGEMENTS
            Thanks to TrackVia Inc. (<http://www.trackvia.com>) for paying for Rob Polocz working time.

## COPYRIGHT AND LICENSE
    Copyright (C) 2008 by Dmitry Ovsyanko

    This library is free software; you can redistribute it and/or modify it under the same terms as
    Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may
    have available.

