Config Command
Manage type configurations
Usage
Manage type configurations that define how Excel files are imported into your database. This command lets you create, list, view, and validate configurations.
excel-to-sql config [OPTIONS]Options
Various operations to manage your type configurations throughout their lifecycle.
--add-type TEXT Add new type configuration
--table TEXT Target table name
--pk TEXT Primary key column(s)
--file TEXT Excel file for auto-detection
--list List all mappings
--show TEXT Show mapping details
--remove TEXT Remove mapping
--validate Validate all mappingsExamples
Add New Type
Create a minimal type configuration with just a type name, table name, and primary key.
excel-to-sql config add --type products --table products --pk idAdd with Auto-Detection
Let the command analyze your Excel file and automatically suggest column mappings based on the data.
excel-to-sql config add --type products --table products --pk id --file products.xlsxThis analyzes the Excel file and suggests column mappings.
List All Types
View all configured type mappings in a tabular format.
excel-to-sql config --listOutput:
Configured Types:
┌──────────────┬───────────────┬─────────────┐
│ Type │ Table │ Primary Key │
├──────────────┼───────────────┼─────────────┤
│ products │ products │ id │
│ customers │ customers │ id │
│ orders │ orders │ id │
└──────────────┴───────────────┴─────────────┘Show Type Details
Display the complete configuration for a specific type including all column and value mappings.
excel-to-sql config --show productsRemove Type
Delete a type configuration that's no longer needed.
excel-to-sql config --remove old_typeValidate All Configurations
Check all configurations for errors like missing primary keys, duplicate columns, or invalid data types.
excel-to-sql config --validateConfiguration File
All type configurations are stored in a single JSON file that you can edit manually or manage through the command line.
Type configurations are stored in config/mappings.json:
{
"products": {
"target_table": "products",
"primary_key": ["id"],
"column_mappings": {
"ID": {"target": "id", "type": "integer"},
"Name": {"target": "name", "type": "string"}
},
"value_mappings": [
{
"column": "status",
"mappings": {"1": "Active", "0": "Inactive"}
}
]
}
}Column Types
Excel-to-sql supports five core SQL data types that cover most use cases.
Supported SQL types:
| Type | Description | Example |
|---|---|---|
string | TEXT columns | "Widget A" |
integer | Int64 (nullable) | 42 |
float | REAL columns | 19.99 |
boolean | Boolean (0/1) | 1 |
date | TIMESTAMP | "2025-01-26" |
Composite Keys
For tables that require multiple columns to uniquely identify a row, specify them as a comma-separated list.
Multiple column primary keys:
excel-to-sql config add --type order_items --table order_items --pk order_id,product_idManual Configuration
For complex configurations, you can edit the JSON file directly with any text editor.
You can also edit config/mappings.json directly:
nano config/mappings.jsonThen validate:
excel-to-sql config --validateCommon Workflows
Three typical workflows depending on your level of automation preference.
Workflow 1: Quick Setup with Auto-Detection
Fastest method for single-table imports with automatic column detection.
# 1. Initialize
excel-to-sql init
# 2. Add type with auto-detection
excel-to-sql config add --type products --table products --pk id --file products.xlsx
# 3. Import
excel-to-sql import --file products.xlsx --type productsWorkflow 2: Manual Configuration
Full control over every aspect of the configuration.
# 1. Add basic type
excel-to-sql config add --type products --table products --pk id
# 2. Edit mappings.json
nano config/mappings.json
# 3. Validate
excel-to-sql config --validate
# 4. Import
excel-to-sql import --file products.xlsx --type productsWorkflow 3: Auto-Pilot (Recommended)
Fully automated configuration generation with intelligent pattern detection.
# Let Auto-Pilot generate everything
excel-to-sql magic --data . --interactive
# Copy generated config
cp .excel-to-sql/mappings.json config/
# Import
excel-to-sql import --file products.xlsx --type productsValidation Errors
The validate command checks for common configuration mistakes and helps you fix them.
Common validation errors:
"Primary key not found in column mappings"
# Ensure primary key is in column_mappings
excel-to-sql config add --type products --table products --pk ID"Duplicate column in mappings"
# Edit config/mappings.json to remove duplicates
nano config/mappings.json"Invalid data type"
# Use valid types: string, integer, float, boolean, dateSee Also
- Configuration documentation - Complete configuration guide
- import command - Import with configuration
- Auto-Pilot mode - Auto-generate configurations