IMPORT CSV Statement

Imports a CSV (comma-separated values) file from disk into a notebook table. This statement is the scripting equivalent of the visual import wizard accessed via the Import menu.

Syntax


Parameters

Options

Example

-- All column imported as text.
IMPORT CSV 'C:\file.csv' INTO table1;

-- Selected columns imported as text.
IMPORT CSV 'C:\file.csv' INTO table2 (foo);

-- Selected columns imported with specified data conversions, falling
-- back to text for any value in the input data that can't be converted.
IMPORT CSV 'C:\file.csv' INTO table3 (foo INTEGER, bar TEXT);

-- No header row in the file. Default names "column1", "column2", etc.
-- can be renamed with "AS".
IMPORT CSV 'C:\file.csv' INTO table4 (column1 AS foo, column2 AS bar)
OPTIONS (HEADER_ROW: 0);

-- Semicolon-separated file.
IMPORT CSV 'C:\semicolon.csv' INTO table5 OPTIONS (SEPARATOR: ';');