This Python script is a simple and effective tool that allows you to convert Excel files into a SQL database. Perfect for those looking for a quick and easy solution to migrate data from spreadsheets to a SQL database.
First, clone this repository on your local machine using https://github.com/JCastro-bit/EXCEL-TO-SQL.git
.
Make sure you have Python , pymysql, openpyxl, sqlalchemy and Pandas installed in your environment.
-
Clone the repository
git clone https://github.com/JCastro-bit/EXCEL-TO-SQL.git ```
-
Change to the project directory
cd exceltosql ```
-
Install the required packages
pip install pymysql pip install openpyxl pip install sqlalchemy pip install Pandas ```
-
Place your
.xlsx
file in the project folder. -
Add the database credentials.
# Create the database connection engine = create_engine('mysql+pymysql://root:0000@localhost:3306/database') ```
-
In the
exceltosql.py
script, update the filename in the line that saysdf = pd.read_excel('filename_of_your_file.xlsx')
. -
Run the script using Python.
python exceltosql.py ```
And that's it, your Excel data is now in your SQL database!