I'm a beginner in python3 and sqlite3 coding; I'm working to code a small program to manage my production process: I need to import database from my old xlsx file to the sqlite3 database to speed the input process.
When I run it, nothing has been imported to the sqlite database even though the result says, data imported successfully!
I'm using Fedora Linux with Python3 and Sqlite3.
My script:
import pandas as pd
from sqlalchemy import create_engine
import sqlite3
import os
# Path to your SQLite database
db_path = "sqlite:///peanut_butter.db"
engine = create_engine(db_path)
# Path to your Excel file
excel_file_path = "/home/redbahi/Greenland_management_software / pandas_excel_database91224.xlsx"
# Read sheets from Excel
clients_df = pd.read_excel(excel_file_path, sheet_name="clients")
suppliers_df = pd.read_excel(excel_file_path, sheet_name="suppliers")
products_df = pd.read_excel(excel_file_path, sheet_name="products")
# Upload data to SQLite
clients_df.to_sql('clients', engine, if_exists='replace', index=False)
suppliers_df.to_sql('suppliers', engine, if_exists='replace', index=False)
products_df.to_sql('products', engine, if_exists='replace', index=False)
print("Data successfully uploaded to the database.")
...Greenland_management_software / pandas_excel_database91224.xlsx
. ... ?