Skip to content

Export to excel on windows fails. #142

Open
@luusluus

Description

@luusluus

What happens

When I try to export to excel using the spatial extension in typescript using duckdb-node package I get the following error:

[Error: IO Error: Cannot open file "C:\Users\lucie\tmp_output.xlsx": The system cannot find the file specified.
] {
  errno: -1,
  code: 'DUCKDB_NODEJS_ERROR',
  errorType: 'IO'
}
undefined

I've tried the duckdb CLI and I have written a python client to do the exact same thing and they work as intended.

To Reproduce

Install nodejs v20.9.0

Open command prompt:

npm i -g ts-node
npm i -g duckdb

code:

import * as duckdb from "duckdb";

async function exportExcel () {
    const db = new duckdb.Database(":memory:");
    
    db.all(`
        INSTALL spatial; LOAD spatial;
        COPY (SELECT 1 as a, 2 as b) TO 'C:\\Users\\lucie\\output.xlsx' WITH (FORMAT GDAL, DRIVER 'xlsx');
      `, function(err, res) {
        if (err) {
            console.warn(err);
        } 
        console.log(res);
      }
    );
}

exportExcel().catch((e) => {
    console.log(e);
});

OS:

Microsoft Windows 11 Pro

DuckDB version:

1.1.3

DuckDB Client:

duckdb-node

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions