Saturday 20 April 2024

Convertion Excel SpreadSheets into SQLITE3 Database via python on Fedora 40 WKS

 Original task proposed here  https://inf-ege.sdamgia.ru/problem?id=47000 

Python script code

(.env) boris@fedora40RCKDE:~/EXCEL$ cat excelSqlite.py
import sqlite3
import pandas as pd
 
con = sqlite3.connect('cps.db')
wb = pd.read_excel('031.xlsx',sheet_name = None)
for sheet in wb:
   wb[sheet].to_sql(sheet,con,index=False)
con.commit()
con.close()

$  rm -f cps.db
$  touch -f cps.db
$  python excelSqlite.py

Database tables structure

















SQL QUERY OUTPUT
















SOLVE USE SAMPLE OUTPUT obtained via excel filtering

















No comments:

Post a Comment

Convertion Excel SpreadSheets into SQLITE3 Database via python on Fedora 40 WKS

  Original task proposed here   https://inf-ege.sdamgia.ru/problem?id=47000   Python script code (.env) boris@fedora40RCKDE : ~/EXCEL $ cat ...