Documentation
Getting Started
Follow these simple steps to start querying your files:
- Upload your CSV, JSON, or Parquet files using the file uploader
- Your files will automatically be converted to database tables
- Expand the table list card to view the schema (column names and types) for each table
- Write SQL queries in the editor
- Click "Run Query" or press Ctrl+Enter to execute
- View your results in the table below
Supported File Formats
CSV Files
Comma-separated values files are automatically parsed. The first row is used as column names.
JSON Files
Both line-delimited JSON (NDJSON) and standard JSON arrays are supported.
Parquet Files
Apache Parquet files are natively supported for efficient columnar data processing.
Query History
SQL for Files automatically saves your query history to help you track and reuse your work:
- Auto-save: Every query you execute is automatically saved to your browser's local storage
- Quick access: Click the "History" button next to the Run Query button to view all saved queries
- Load queries: Click any query in the history to load it back into the editor
- Status tracking: See success/error status and row counts for each executed query
- Download queries: Save any query as a .sql file for sharing or backup
- Clear history: Remove individual queries or clear all history at once
Database Export & Import
Save your work and restore it later using the database export/import feature:
Export Database
- Click the "Export" button in the Tables section to download all your tables
- Creates a ZIP file containing all table data in csv format
- Includes metadata with table schemas, column types, and row counts
- Perfect for backing up your work or sharing datasets with others
Import Database
- Click the "Import" button to restore a previously exported database
- Select the ZIP file you exported earlier
- All tables and data will be automatically recreated
- Original files are stored in browser storage for persistence
Table Preview
Quickly preview table contents without writing a query:
- Click the eye icon next to any table name in the Tables list
- Automatically runs
SELECT * FROM table LIMIT 10 - Great for quickly inspecting table structure and sample data
Keyboard Shortcuts
- Ctrl+Enter (or Cmd+Enter on Mac) - Execute query or selected text
- Ctrl+/ - Toggle comment (in editor)
- Escape - Close query history dropdown
Tips & Best Practices
- Table names are automatically derived from your file names. If a file name starts with a number, the prefix 'table_' is automatically added (e.g., '2023_sales.csv' becomes 'table_2023_sales')
- Query results are limited to displaying 1000 rows in the UI for performance, but CSV exports include all rows from your query
- All processing happens in your browser - your data stays private
- Use LIMIT to preview large datasets before running complex queries
- DuckDB supports advanced SQL features like window functions and CTEs
Memory & Performance Limits
SQL for Files runs entirely in your browser for privacy and convenience, but this comes with memory constraints:
Browser Memory Limits
Browsers have hard memory limits (typically 4GB), with a practical working limit of 2-3GB for data processing.
How We Handle Large Results
- Display Optimization: Only the first 1,000 rows are converted to JavaScript objects and displayed in the table. This keeps the UI responsive even with large query results.
- Full Data Export: When you export to CSV, all rows from your query are included, not just the displayed 1,000.
- Automatic Warnings: The console will warn you when results exceed 100,000 rows and alert you about potential memory issues when results exceed 1,000,000 rows.
Best Practices for Large Files
- Start Small: Test your queries with
LIMIT 100first to verify correctness before running on the full dataset - Use Aggregations: Instead of retrieving all rows, use
GROUP BY,COUNT, and other aggregations to summarize data - Filter Early: Use
WHEREclauses to reduce the result set before processing - Parquet Format: For files over 100MB, use Parquet format which is more memory-efficient than CSV or JSON
- Watch File Sizes: Files over 200MB may cause performance issues. Consider splitting them or using aggregations
Why These Limits Exist
Unlike server-based SQL tools, browser applications cannot use disk storage for temporary data ("spilling to disk"). All query processing must happen in RAM. This makes the tool more private and convenient (no server needed!), but means very large datasets may need to be processed in chunks or on a traditional database server.
SQL Examples
Basic Query
SELECT * FROM your_table LIMIT 10;Filtering Data
SELECT name, age, city
FROM users
WHERE age > 25
ORDER BY name;Aggregations
SELECT
country,
COUNT(*) as total_users,
AVG(age) as avg_age
FROM users
GROUP BY country
ORDER BY total_users DESC;Joining Tables
SELECT
o.order_id,
c.customer_name,
o.total_amount
FROM orders o
JOIN customers c ON o.customer_id = c.id
WHERE o.total_amount > 100;Frequently Asked Questions (FAQ)
Q: Is my data really private?
A: Yes! All data processing happens entirely in your browser using WebAssembly. Your files never leave your device and are never sent to any server. You can verify this by checking your browser's network tab - no data uploads occur.
Q: What happens if I refresh the page?
A: Your query history is automatically saved to browser storage and will persist across sessions. However, your uploaded files and tables are currently lost on refresh unless you export your database first. We recommend exporting your database before closing if you want to continue your work later.
Q: Can I use this with Excel (.xlsx) files?
A: Unfortunately, Excel files (.xlsx) are not currently supported due to limitations in the DuckDB WASM implementation. However, you can easily convert Excel files to CSV using Excel's "Save As" feature or online converters, then upload the CSV file.
Q: How large can my files be?
A: Browser memory limits typically cap working data at 2-3GB. Files up to 200MB generally work well. For larger files, consider using Parquet format (more memory-efficient) or filtering/aggregating your data to reduce result set sizes.
Q: Can I execute multiple queries at once?
A: You can write multiple SQL statements separated by semicolons, but only the last statement's results will be displayed. If you want to see results from multiple queries, execute them one at a time. You can also select specific SQL text in the editor and press Ctrl+Enter to run just that selection.
Q: Does this work offline?
A: Once the page is loaded, most functionality works offline since everything runs in your browser. However, the initial page load requires an internet connection to download the application and DuckDB WASM files (~150MB).
Troubleshooting
Issue: "Out of memory" error
Solutions:
- Use LIMIT to reduce the number of rows returned
- Use aggregation queries (GROUP BY, COUNT) instead of selecting all rows
- Close other browser tabs to free up memory
- Try using Parquet format instead of CSV for large files
- Split large files into smaller chunks
Issue: File upload fails or table creation errors
Solutions:
- Ensure your CSV file has a header row with column names
- Check that your JSON file is valid (array of objects or newline-delimited JSON)
- Verify the file isn't corrupted by opening it in a text editor
- Try renaming the file if it contains special characters
- Check browser console (F12) for detailed error messages
Issue: Query runs forever or browser becomes unresponsive
Solutions:
- Queries timeout after 30 seconds automatically
- Add LIMIT clauses to test queries before running on full dataset
- Use WHERE clauses to filter data early in the query
- Avoid cartesian joins (missing JOIN conditions)
- If browser freezes, refresh the page and start over
Issue: Table names don't appear or autocomplete doesn't work
Solutions:
- Wait a few seconds after upload for tables to be registered
- Try refreshing the page (note: you'll need to re-upload files)
- Check the Tables section to verify your tables were created
- Type a few characters to trigger autocomplete suggestions
Issue: Page is slow to load
Solutions:
- First load downloads ~150MB of DuckDB WASM files - this is normal
- Subsequent loads should be faster thanks to browser caching
- Check your internet connection speed
- Try using a modern browser (Chrome, Firefox, Safari, Edge)
Still having issues?
Check the browser console (press F12 → Console tab) for detailed error messages. These often provide specific information about what went wrong and can help you debug issues with your queries or data files.
You can also reach out to info@sqlforfiles.app if problems occur. There's no guarantee, but I try to help.