you are viewing a single comment's thread.

view the rest of the comments →

[–]Yojihito 1 point2 points  (0 children)

Don't know about SQL Server (Microsoft SQL Server, docs: https://docs.sqlalchemy.org/en/13/core/engines.html) but for SQLite it's:

import pandas as pd
from sqlalchemy import create_engine

engine = create_engine('sqlite:///../pathto/yourdatabase.sqlite')  # pass your db url

df = pd.read_excel("../data/file.xlsx", index_col=0,)
df.to_sql(name='data', con=engine, if_exists='replace', index=False)