Skip to content

Instantly share code, notes, and snippets.

@frruit
Last active August 29, 2015 14:17
Show Gist options
  • Save frruit/7b859958f33514917800 to your computer and use it in GitHub Desktop.
Save frruit/7b859958f33514917800 to your computer and use it in GitHub Desktop.
This example shows how to import an excel file into an Sqlite table with pandas and sqlsoup
import pandas as pd
import sqlsoup
db = sqlsoup.SQLSoup('sqlite:///pandas.db')
engine = db.engine
# Read Excel
df = pd.read_excel('excel_file.xlsx',
0, # Sheet
index_col=None,
na_values=['NA'],
skiprows=1 # First row is invalid
)
# Store as SQL
df.to_sql('excel_file_table', engine, if_exists="replace")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment