-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: Query View - Export to Excel not working on Windows #99
Comments
I'll look into this first thing. |
I've managed to build my app on windows and debug it and it seems to be a bug on duckdb's side. I've tried to run the export without path characters like so: COPY (SELECT * FROM tbl) TO 'test.xlsx' WITH (FORMAT GDAL, DRIVER 'xlsx'); instead of providing a path like I'll try to do some more testing or reading docs. But if all fails, I'll open an issue at duckdb |
Does it perhaps need double backslashes to escape in the file path? Or maybe somehow forward slashes might work even though technically Windows uses backslashes. Could also be related to GDAL specifically. |
That's the way how it is in the current version. At least the string in memory would be I've also already tried forward slashes. same error. Yes, that could be the case, because duckdb doesn't have excel support natively. You have to install the spatial extension within duckdb. |
I have the found the repo where I should report issues to https://github.com/duckdb/duckdb_spatial Things I have tried:
I'll try to reproduce the error by using duckdb CLI on windows. |
In command prompt
In command prompt as administrator
In admin this seems to work fine. I haven't been able to reproduce it. |
I've written a python client and ran it in windows import duckdb
con = duckdb.connect()
con.install_extension("spatial")
con.load_extension("spatial")
con.sql("COPY (SELECT 1 as a, 2 as b) TO 'output.xlsx' WITH (FORMAT GDAL, DRIVER 'xlsx')") This seems to work fine. |
I've also written a typescript client and ran it in windows 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);
}) outputs
So I reproduced the error with a simple typescript client in windows, while python and cli on windows just work fine. |
I've created an issue here: While we wait for a fix from their side, I'll disable the export for windows only. |
I tested this some more and got it working. I had to make files called output.xlsx AND tmp_output.xlsx in my output folder. When I replaced output.xlsx by exporting, it removes temp_output.xlsx and replaces the output.xlsx. Is it possible to have it create the 2 blank .xlsx files there first before it tries to replace them? That would fix it. You might have to force it using another library or something. |
Amazing, this could work. Maybe just creating an empty file will work? I'll try. |
Hmm that doesn't work. I created two empty files called
So I'll have to try to output to excel with another library. |
Fix here: #109 |
Error:
Export failed: IO Error: Cannot open file "c:\Test\test.xlsx": The system cannot find the file specified.
Might be Windows specific
The text was updated successfully, but these errors were encountered: