info > DBD::Excel

```html

๐Ÿ“˜ Excel(3pm) โ€” User Contributed Perl Documentation โ€” Excel(3pm)

๐Ÿ“– NAME

DBD::Excel โ€” A class for DBI drivers that act on Excel File.

โš ๏ธ This is still alpha version.

๐Ÿš€ Quick Reference

Use CaseCommandDescription
๐Ÿ”— Connect to an Excel fileDBI->connect("DBI:Excel:file=test.xls")Establishes a DBI connection to an Excel workbook
๐Ÿ“ฆ Create a table (worksheet)$hDb->prepare("CREATE TABLE a (id INTEGER, name CHAR(10))")Creates a new worksheet with specified columns
๐Ÿ“‹ List all sheets (tables)$hDb->func('list_tables')Returns an array of sheet names in the workbook
๐Ÿ“‚ Get data source list$hDr->data_sources( { xl_dir => '/path' } )Returns list of Excel files in a directory
โš™๏ธ Use temporary table definitionDBI->connect(..., { xl_vtbl => { ... } })Define a custom table area within a worksheet

๐Ÿ“‹ SYNOPSIS

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();

๐Ÿ“ DESCRIPTION

โš ๏ธ This is still alpha version.

The DBD::Excel module is a DBI driver. The module is based on these modules:

This module assumes TABLE = Worksheet. The contents of first row of each worksheet as column name.

Adding that, this module accepts temporary table definition at connect method with xl_vtbl.

Example:

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 to sample/tex.pl included in this distribution.

๐ŸŽฏ Metadata

The following attributes are handled by DBI itself and not by DBD::Excel, thus they all work like expected:

The following DBI attributes are handled by DBD::Excel:

These attributes and methods are not supported:

Additional to the DBI attributes, you can use the following dbh attribute:

๐Ÿ› ๏ธ Driver private methods

๐Ÿ“‹ TODO

๐Ÿ› KNOWN BUGS

๐Ÿ‘ค AUTHOR

Kawai Takanori (Hippo2000) kwitknr AT cpan.org

๐Ÿ“š SEE ALSO

DBI, Spreadsheet::WriteExcel, Spreadsheet::ParseExcel, SQL::Statement

ยฉ๏ธ COPYRIGHT

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.

```
DBD::Excel
๐Ÿ“– NAME ๐Ÿš€ Quick Reference ๐Ÿ“‹ SYNOPSIS ๐Ÿ“ DESCRIPTION
๐ŸŽฏ Metadata ๐Ÿ› ๏ธ Driver private methods
๐Ÿ“‹ TODO ๐Ÿ› KNOWN BUGS ๐Ÿ‘ค AUTHOR ๐Ÿ“š SEE ALSO ยฉ๏ธ COPYRIGHT

Generated by phpman v4.9.26-1-g511901d Author: Che Dong Under GNU General Public License
2026-08-09 09:30 @2600:1f28:365:80b0:50b3:453e:ff52:20f7
CrawledBy CCBot/2.0 (https://commoncrawl.org/faq/)
Valid XHTML 1.0 Transitional!Valid CSS!
Enhanced by LLM: deepseek-v4-flash / taotoken.net / www.chedong.com - original format