The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Spreadsheet::WriteExcel::FromDB - Convert a database table to an Excel spreadsheet

SYNOPSIS

  use Spreadsheet::WriteExcel::FromDB;

  my $dbh = DBI->connect(...);

  my $ss = Spreadsheet::WriteExcel::FromDB->read($dbh, $table_name);
     $ss->ignore_columns(qw/foo bar/);

  print $ss->as_xls;

DESCRIPTION

This module exports a database table as an Excel Spreadsheet.

The data is not returned in any particular order, as it is a simple task to perform this in Excel. However, you may choose to ignore certain columns, using the 'ignore_columns' method.

This relies on us knowing how to access the table information for this database. This is done by delegating the call 'columns_in_table' to an appropriate subclass. (At the moment this only exists for MySQL, PostgreSQL and Sybase, but please send me more!)

METHODS

read

Creates a spreadsheet object from a database handle and a table name.

dbh / table

Accessor / mutator methods for the database handle and table name.

ignore_columns

  $ss->ignore_columns(qw/foo bar/);

Do not output these columns into the spreadsheet.

as_xls

Return the table as an Excel spreadsheet.

BUGS

Dates are handled as strings, rather than dates.

AUTHOR

Tony Bowden, <kasei@tmtm.com>.

SEE ALSO

Spreadsheet::WriteExcel::Simple. Spreadsheet::WriteExcel. DBI

COPYRIGHT

Copyright (C) 2001 Tony Bowden. All rights reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.