snorkysnark / xl2pg

Scripts for uploading excel spreadsheet to postgresql
0 stars 0 forks source link

xl2pg

Upload an excel spreadsheet to postgres

Usage

python xl2pg.py spreadsheet.xlsx -d db.json --map map.json

Arguments:

Optional arguments:

Configuration

map.json example

{
  "target_schema": "public",
  "target_table": "table_name",
  "sheet": 0, // Use the first (zeroth) sheet in the excel file
  "skip_rows": 1, // Skip the headings row in the spreadsheet
  "mapping": {
    "field1": 1, // key is a field inside target_table,
    "field2": 3, // value is the corresponding column in the spreadsheet
    "field3": 5,
    ...
  }
}

Dependencies