Import Command
Import Excel files into SQLite
Usage
Import an Excel file into your SQLite database using a predefined type configuration. The command applies all configured transformations, validations, and mappings automatically.
excel-to-sql import --file FILE --type TYPERequired Options
These parameters are mandatory for every import operation.
-f, --file TEXT Path to Excel file (required)
-t, --type TEXT Type configuration name (required)Optional Options
Additional parameters to control import behavior and output verbosity.
--force Re-import even if content unchanged
--verbose, -v Show detailed import progressExamples
Basic Import
Import an Excel file using a predefined type configuration.
excel-to-sql import --file products.xlsx --type productsImport with Full Path
Use absolute paths when the Excel file is in a different directory.
excel-to-sql import --file /path/to/data.xlsx --type mytypeForce Re-import
Override the content hash check and re-import the file even if it hasn't changed.
excel-to-sql import --file products.xlsx --type products --forceWhat Happens During Import
The import process follows a seven-step pipeline to transform and validate your data:
- Read Excel File: Loads using openpyxl
- Apply Column Mappings: Transform column names and types
- Apply Value Mappings: Transform cell values
- Calculate Columns: Create derived columns
- Validate Data: Check against validation rules
- UPSERT: Insert new rows or update existing rows
- Store Metadata: Record import in history
Output
The command provides real-time feedback during the import process.
✓ Loading Excel file: products.xlsx
✓ Found sheet: Sheet1
✓ Applying column mappings...
✓ Applying value mappings...
✓ Importing 150 rows into table 'products'
✓ Import completed in 0.23sImport History
Every import is automatically logged. View your complete import history with the status command.
View import history:
excel-to-sql statusError Handling
Common Errors
"Type configuration not found"
# Create the type first
excel-to-sql config add --type products --table products --pk id"Primary key column not found"
# Check your Excel file has the primary key column
# Or update the config with the correct column name"File not found"
# Use absolute path
excel-to-sql import --file /full/path/to/file.xlsx --type productsIncremental Imports
excel-to-sql uses content hashing to detect changes. If the file content hasn't changed, the import is skipped (unless --force is used). This intelligent caching saves time on repeated imports of unchanged files.
Performance: Large files (10,000+ rows) may take longer. Use --force only when necessary.
See Also
- export command - Export data back to Excel
- config command - Configure types
- Auto-Pilot mode - Auto-generate configurations