sql_excel.py 419 B

123456789101112131415
  1. import pandas as pd
  2. from sqlalchemy import create_engine
  3. file = "Planung_2020.xlsx"
  4. sheet = "Planung"
  5. output = "result.xlsx"
  6. engine = create_engine("sqlite://", echo=False)
  7. df = pd.read_excel(file, sheet_name=sheet)
  8. df.to_sql("planung", engine, if_exists="replace", index=False)
  9. results = engine.execute("SELECT * FROM planung")
  10. final = pd.DataFrame(results, columns=df.columns)
  11. final.to_excel(output, index=False)