ODBC Driver for Google Sheets

Build 24.0.9060

Discovering Schemas

The following sections show how to obtain schema information.

List Tables and Views

You can use the tables method to discover what tables and views are available through the driver. This returns results through a callback like a query would.

db.tables(null, null, null, null, (err, tables_views)  => {
    for (var i = 0; i < tables_views.length; i++) {
        var row = tables_views[i];
        console.log("Catalog: " + row.TABLE_CAT +
                    ", Schema: " + row.TABLE_SCHEM +
                    ", Table: " + row.TABLE_NAME +
                    ", Type: " + row.TABLE_TYPE);
    }
});

You can use the columns method to discover what columns are available on a table or view.

db.columns(null,null,"Spreadsheet1_Sheet1", null, (err, columns)  => {
    for (var i = 0; i < columns.length; i++) {
        var row = columns[i];
        console.log("Name: " + row.COLUMN_NAME +
                    ", Type: " + row.DATA_TYPE +
                    ", Length: " + row.COLUMNS_SIZE +
                    ", Precision: " + row.DECIMAL_DIGITS +
                    ", Nullable: " + row.IS_NULLABLE);
    }
});

Copyright (c) 2024 CData Software, Inc. - All rights reserved.
Build 24.0.9060