CSV import/export • Encoding • Data types
Import and Export CSV in DB Browser (SQLCipher)
Import CSV into an encrypted database or export tables and query results to CSV with predictable encoding and delimiters. This guide covers common pitfalls, data type mapping and large file strategies on Windows.
Import CSV into an encrypted database
- Open your encrypted database (how to open) and choose Import → Table from CSV.
- Pick the CSV file and set delimiter (comma, semicolon, tab), quote and encoding (UTF‑8 recommended).
- Review detected headers and map columns to target names and types (INTEGER, REAL, TEXT, BLOB). Add constraints if needed.
- Run the import and verify row counts. Spot‑check a few records and special characters.
Large files? Split into chunks, or import into a staging table and then transform with SQL for better control.
Trouble importing? See Troubleshooting for encoding and delimiter issues.
Export a table or query to CSV
- Select the table you want to export, or run a SELECT query to produce the desired result set.
- Choose Export → Table (or Query) to CSV, set delimiter and quoting, and pick UTF‑8 unless a consumer requires another encoding.
- Save the file and validate it in a text editor (headers, separators, sample rows).
Dates and times: prefer ISO‑8601 (YYYY‑MM‑DD, HH:MM:SS) for predictable parsing in other tools.
Data types, NULLs and cleaning
- Types: SQLite is flexible; choose practical affinities. Validate numeric and date fields after import.
- NULLs: Decide how to represent empty values (empty string vs literal NULL) and configure the importer accordingly.
- Whitespace: Trim fields if the source adds trailing spaces; standardize line endings (Windows CRLF).
Need structured examples? See Useful SQL/PRAGMA commands for post‑import checks.
Performance and large files
- Import in batches; wrap large operations in transactions where possible.
- Consider temporary indexes for faster dedup/joins, then drop them.
- Disable non‑critical triggers during bulk load, re‑enable afterwards.
More guidance: Performance tips.