Skip to content

Having trouble importing CSV files into DuckDB-Wasm #704

Answered by domoritz
yilan007 asked this question in Q&A
Discussion options

You must be logged in to vote

conn is a connection. Here is a code snippet from the DuckDB Observable client. So note that you call insertCSVFromPath on the connection.

 async insertCSV(name, buffer, options) {
    const db = await this.db();
    await db.registerFileBuffer(name, new Uint8Array(buffer));
    const conn = await db.connect();
    await conn.insertCSVFromPath(name, { name, schema: "main", ...options });
    await conn.close();
 }

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@yilan007
Comment options

Answer selected by yilan007
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants