How to Import Excel into PostgreSQL Using Python | Real Bakery Data Example (2025)

Опубликовано: 18 Апрель 2026
на канале: Data Geek is my name
917
23

Learn how to import Excel files into a PostgreSQL database using Python in this beginner-friendly tutorial!
In this video, we use a real-world bakery sales dataset and walk you through the entire process step-by-step—from reading Excel with pandas, connecting to PostgreSQL with psycopg2, and inserting data into a SQL table.
Whether you're a data analyst, student, or developer, this workflow will help you automate your data pipeline and master real-world database tasks.

If you're using Anaconda like I am, and you get an error for psycopg2, just run this :
pip install psycopg2-binary

🔹 Tools used :
✔️ Jupyter Notebook (Anaconda)
✔️ PostgreSQL (pgAdmin)
✔️ pandas + psycopg2 libraries

🔹 What you'll learn :
✔️ How to read Excel files with pandas
✔️ How to connect Python to PostgreSQL
✔️ How to insert Excel rows into SQL using Python
✔️ Tips to clean and convert your data
✔️ Real-world use cases with bakery sales data

🔗 GitHub Files & Notebook: https://github.com/data-geek-lab/exce...
👉 Subscribe:    / @datageekismyname  
☕ Support my channel: Buy me a coffee:
   / @datageekismyname  
Or
*Donate on paypay*:
https://www.paypal.com/donate/?hosted...

💬 Drop your questions or project ideas in the comments. I read and reply to all!

How to download Anaconda to use Jupyter Notebook for Python coding:    • How to Download Anaconda for Jupyter Noteb...  

*How to download Postgresql:    • Install PostgreSQL on Windows (Beginner Tu...  

===== Continue your learning ========
Get the Data Analytics Kickstart eBook—your all-in-one beginner guide to Python, SQL & Power BI.
Includes real-world examples, cheat sheets, 3 real-world data project ideas, and video walkthroughs! -- https://www.datageekismyname.com/ebook

#python #postgresql #exceltosql #dataautomation #dataanalytics #learnsql #psycopg2 #jupyternotebook

⏳ Timestamps ⏳
00:00 Intro
0:56 Reviewing the dataset in excel
01:29 Open PgAdmin to create a your database in postgresql
02:40 Open Jupyter Notebook to create python code
03:10 Step 1: Import libraries
03:36: How to load the excel file dataset into Jupyter Notebook
04:56 Step 2. Load the excel data
06:29 Step 3. Connect to Postgresql database
08:37 Step 4. Create a table PostgreSQL (run this only once)
12:55 Step 5. Prepare the
19:20 Close connection (good practice to always close SQL connection)
19:46 Outro (Thank you for watching I hope this tutorial helps.)

Disclaimer: This content is for educational purposes only. Affiliate links may be included, and I may earn a small commission at no extra cost to you. Thank you for supporting the channel!