vi-sql logo

Import & Export

Export

From the data view, press Alt+m (or open the actions palette with Ctrl+Space) to export the current table or query results.

Supported formats

FormatExtensionNotes
CSV.csvComma-separated, RFC 4180
JSON.jsonArray of row objects
SQL.sqlINSERT statements
Markdown.mdGFM table
Text.txtSpace-delimited aligned columns

The export dialog lets you choose the format and toggle options:

  • Include headers — add a header row (CSV, Markdown, Text)
  • Pretty print — indent JSON output
  • Compress — gzip the output file (available for all formats)

The file is saved to your current working directory by default.

Import CSV

Press Alt+i from anywhere in the main view (or use the actions palette) to import a CSV file into the current table.

vi-sql will:

  1. Read the CSV header row and map columns by name
  2. Show a preview of the first rows
  3. Ask for confirmation before inserting

Requirements

  • The CSV must have a header row
  • Column names must match the target table's columns (extra columns are ignored)
  • The target table must already exist

Example

sh
# CSV file: users.csv
id,name,email
1,Alice,alice@example.com
2,Bob,bob@example.com

Import into the users table → vi-sql runs:

sql
INSERT INTO users (id, name, email) VALUES
  (1, 'Alice', 'alice@example.com'),
  (2, 'Bob', 'bob@example.com');