Reading Excel
Examples of reading Excel files with various range options
Range Syntax
Format
Example
Description
Excel to Database
Using CLI Flags
# Read first sheet (no sheet option = uses first sheet)
$ sling run --src-stream 'file:///path/to/data.xlsx' \
--tgt-conn MY_POSTGRES \
--tgt-object 'public.excel_data' \
--mode full-refresh
# Read first sheet with column range (! prefix without sheet name)
$ sling run --src-stream 'file:///path/to/data.xlsx' \
--src-options '{ sheet: "!A:F" }' \
--tgt-conn MY_POSTGRES \
--tgt-object 'public.excel_data' \
--mode full-refresh
# Read specific sheet
$ sling run --src-stream 'file:///path/to/data.xlsx' \
--src-options '{ sheet: "Sales" }' \
--tgt-conn MY_POSTGRES \
--tgt-object 'public.sales_data' \
--mode full-refresh
# Read specific cell range (A1 to F100)
$ sling run --src-stream 'file:///path/to/data.xlsx' \
--src-options '{ sheet: "Sales!A1:F100" }' \
--tgt-conn MY_POSTGRES \
--tgt-object 'public.sales_data' \
--mode full-refresh
# Read column range (all rows, columns A through F)
$ sling run --src-stream 'file:///path/to/data.xlsx' \
--src-options '{ sheet: "Sales!A:F" }' \
--tgt-conn MY_POSTGRES \
--tgt-object 'public.sales_data' \
--mode full-refresh
# Read row range (rows 5-20, auto-detect columns)
$ sling run --src-stream 'file:///path/to/data.xlsx' \
--src-options '{ sheet: "Sales!5:20" }' \
--tgt-conn MY_POSTGRES \
--tgt-object 'public.sales_subset' \
--mode full-refresh
# Read from row 5 to end (auto-detect columns and last row)
$ sling run --src-stream 'file:///path/to/data.xlsx' \
--src-options '{ sheet: "Sales!5:" }' \
--tgt-conn MY_POSTGRES \
--tgt-object 'public.sales_from_row5' \
--mode full-refresh
# Read partial range (from A5 to column F, extends to last row)
$ sling run --src-stream 'file:///path/to/data.xlsx' \
--src-options '{ sheet: "Sales!A5:F" }' \
--tgt-conn MY_POSTGRES \
--tgt-object 'public.sales_data' \
--mode full-refreshUsing Replication
Using Python
Excel to File (Parquet, CSV, JSON)
Using CLI Flags
Using Replication
Using Python
Advanced Options
Password-Protected Excel Files
Custom Date Patterns
Type Casting
Environment Variables
Variable
Description
Default
Tips
Last updated
Was this helpful?