excel-to-sql

Status Command

View import history

Usage

View the complete import history with timestamps, row counts, and file information. Useful for tracking imports and identifying when data was last updated.

excel-to-sql status

Output

The command displays a formatted table with all imports, sorted by date in descending order (newest first).

Import History:
┌──────────────┬──────────┬────────┬────────────────┬─────────────┐
│ Date         │ Type     │ Rows   │ File           │ Tags        │
├──────────────┼──────────┼────────┼────────────────┼─────────────┤
│ 2025-01-26   │ products │ 150    │ products.xlsx  │ catalog    │
│ 2025-01-25   │ orders   │ 1,250  │ orders.xlsx    │ verified   │
│ 2025-01-24   │ customers│ 500    │ customers.xlsx │            │
└──────────────┴──────────┴────────┴────────────────┴─────────────┘

Total Imports: 3
Total Rows: 1,900

Information Displayed

Each row represents one import operation with key details about what was imported and when.

  • Date: When the import occurred
  • Type: Type configuration used
  • Rows: Number of rows imported
  • File: Original Excel filename
  • Tags: Import tags (if any)

Filters

The CLI doesn't have built-in filtering, but you can query the database directly for more advanced filtering.

View Specific Type

Not directly supported via CLI, but you can query the database:

sqlite3 data/database.db "SELECT * FROM __excel_to_sql_imports WHERE type_name = 'products'"

View Recent Imports

sqlite3 data/database.db "
SELECT * FROM __excel_to_sql_imports
ORDER BY imported_at DESC
LIMIT 10
"

Metadata Tables

Excel-to-sql creates two internal tables to track import history and application metadata.

excel-to-sql stores metadata in internal tables:

__excel_to_sql_imports

CREATE TABLE __excel_to_sql_imports (
  id INTEGER PRIMARY KEY AUTOINCREMENT,
  type_name TEXT NOT NULL,
  file_name TEXT,
  rows_imported INTEGER,
  content_hash TEXT,
  imported_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  tags TEXT
);

__excel_to_sql_metadata

CREATE TABLE __excel_to_sql_metadata (
  key TEXT PRIMARY KEY,
  value TEXT,
  updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

Query Examples

Using SQLite CLI

Open the database directly to run custom SQL queries against the import history.

sqlite3 data/database.db
-- View last 10 imports
SELECT * FROM __excel_to_sql_imports
ORDER BY imported_at DESC
LIMIT 10;

-- Count imports by type
SELECT type_name, COUNT(*) as count
FROM __excel_to_sql_imports
GROUP BY type_name;

-- Find largest imports
SELECT type_name, rows_imported
FROM __excel_to_sql_imports
ORDER BY rows_imported DESC
LIMIT 10;

Using Python SDK

Programmatic access to import history for custom processing or reporting.

from excel_to_sql import ExcelToSqlite

sdk = ExcelToSqlite()

# Get import history
history = sdk.get_import_history()
for record in history:
    print(f"{record['type_name']}: {record['rows_imported']} rows")

Clear History

Delete all import history records from the database. This action cannot be undone.

To clear import history:

sqlite3 data/database.db "DELETE FROM __excel_to_sql_imports"

Warning: Clearing history is permanent. Consider backing up the database first.

Statistics

Generate aggregated statistics about your imports to understand trends and patterns.

Total Import Statistics

sqlite3 data/database.db "
SELECT
  COUNT(*) as total_imports,
  SUM(rows_imported) as total_rows,
  AVG(rows_imported) as avg_rows
FROM __excel_to_sql_imports
"

By Date Range

sqlite3 data/database.db "
SELECT
  DATE(imported_at) as date,
  COUNT(*) as imports,
  SUM(rows_imported) as rows
FROM __excel_to_sql_imports
WHERE imported_at >= date('now', '-7 days')
GROUP BY DATE(imported_at)
ORDER BY date DESC
"

See Also

On this page