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


Spreadsheet-WriteExcel-FromDB documentation  | view source Contained in the Spreadsheet-WriteExcel-FromDB distribution.

Index


NAME

Top

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

SYNOPSIS

Top

  use Spreadsheet::WriteExcel::FromDB;

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

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

  $ss->restrict_rows('age > 10');

  print $ss->as_xls;
  # or
	$ss->write_xls('spreadsheet.xls');

DESCRIPTION

Top

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.

METHODS

Top

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.

restrict_rows

  $ss->restrict_rows('age > 10');

An optional 'WHERE' clause for restricting the rows returned from the database.

ignore_columns

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

Output all columns, except these ones, to the spreadsheet.

include_columns

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

Only include these columns into the spreadsheet.

as_xls

  print $ss->as_xls;

Return the table as an Excel spreadsheet.

write_xls

	$ss->write_xls('spreadsheet.xls');

Write the table to a spreadsheet with the given filename.

BUGS

Top

Dates are handled as strings, rather than dates.

AUTHOR

Top

Tony Bowden

BUGS and QUERIES

Top

Please direct all correspondence regarding this module to: bug-Spreadsheet-WriteExcel-Simple@rt.cpan.org

COPYRIGHT AND LICENSE

Top

SEE ALSO

Top

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


Spreadsheet-WriteExcel-FromDB documentation  | view source Contained in the Spreadsheet-WriteExcel-FromDB distribution.