Skip to content

Examples XLSX Connection

Michael Anderson edited this page Dec 12, 2017 · 1 revision

The XLSX driver connects to a local Excel .xlsx file. The XLSX driver does not support transactions.

Connection URL

xlsx:///file_path

Usage

const Connection = require('database-js2').Connection;

var connection = new Connection('xlsx:///data.xlsx');

Select Some Data

var Connection = require('database-js2');

(async () => {
    let connection, statement, rows;
    connection = new Connection('xlsx:///test.xlsx');
    
    try {
        statement = await connection.prepareStatement("SELECT * FROM Sheet1 WHERE State = ?");
        rows = await statement.query('South Dakota');
        console.log(rows);
    } catch (error) {
        console.log(error);
    } finally {
        await connection.close();
    }
})();