Excel(3pm) | User Contributed Perl Documentation | Excel(3pm) |
DBD::Excel - A class for DBI drivers that act on Excel File.
This is still alpha version.
use DBI; $hDb = DBI->connect("DBI:Excel:file=test.xls") or die "Cannot connect: " . $DBI::errstr; $hSt = $hDb->prepare("CREATE TABLE a (id INTEGER, name CHAR(10))") or die "Cannot prepare: " . $hDb->errstr(); $hSt->execute() or die "Cannot execute: " . $hSt->errstr(); $hSt->finish(); $hDb->disconnect();
This is still alpha version.
The DBD::Excel module is a DBI driver. The module is based on these modules:
reads Excel files.
writes Excel files.
a simple SQL engine.
Of course. :-)
This module assumes TABLE = Worksheet. The contents of first row of each worksheet as column name.
Adding that, this module accept temporary table definition at "connect" method with "xl_vtbl".
ex.
my $hDb = DBI->connect(
"DBI:Excel:file=dbdtest.xls", undef, undef,
{xl_vtbl =>
{TESTV =>
{
sheetName => 'TEST_V',
ttlRow => 5,
startCol => 1,
colCnt => 4,
datRow => 6,
datLmt => 4,
}
}
});
For more information please refer sample/tex.pl included in this distribution.
The following attributes are handled by DBI itself and not by DBD::Excel, thus they all work like expected:
Active ActiveKids CachedKids CompatMode (Not used) InactiveDestroy Kids PrintError RaiseError Warn (Not used)
The following DBI attributes are handled by DBD::Excel:
These attributes and methods are not supported:
bind_param_inout CursorName LongReadLen LongTruncOk
Additional to the DBI attributes, you can use the following dbh attribute:
If you want to read the subdirectories of another directory, use
my($hDr) = DBI->install_driver("Excel"); my(@list) = $hDr->data_sources( { xl_dir => '/usr/local/xl_data' } );
my $hDb = DBI->connect("DBI:Excel:file=test.xls"); my @list = $hDb->func('list_tables');
Kawai Takanori (Hippo2000) kwitknr@cpan.org
Homepage: http://member.nifty.ne.jp/hippo2000/ (Japanese) http://member.nifty.ne.jp/hippo2000/index_e.htm (English) Wiki: http://www.hippo2000.net/cgi-bin/KbWiki/KbWiki.pl (Japanese) http://www.hippo2000.net/cgi-bin/KbWikiE/KbWiki.pl (English)
DBI, Spreadsheet::WriteExcel, Spreadsheet::ParseExcel, SQL::Statement
Copyright (c) 2001 KAWAI,Takanori All rights reserved.
You may distribute under the terms of either the GNU General Public License or the Artistic License, as specified in the Perl README file.
2022-06-13 | perl v5.34.0 |