Загрузка страницы

Auto Export Data into Excel from SQL using Python Pyodbc | Python SQL Automation |Task Scheduler #16

In this video you will learn or explore something new related to Python and SQL Server Automation.

Auto Export Data into Excel from SQL using Python Pyodbc | Python SQL Automation | Task Scheduler

First of all we will establish the connection between Python and SQL Server using pyodbc (To create the SQL connection is very easy as compare to other programming language). After that we will read the data from SQL and store in Pandas DataFrame and very interest part is we will display the notification status on user's screen and that notification you can customize based on your need.

And at the last, we will schedule the script using Task Scheduler to run on the specific date and time. So Let's go!!!

Python SQL Server Script:
------------------------------------------------------------------------------------------------------------------
import pyodbc
import pandas as pd
import os
from datetime import datetime
from plyer import notification

# create SQL connection
connection = pyodbc.connect(driver = '{ODBC Driver 17 for SQL Server}',
host = 'DESKTOP-NAKP5E5',
database = "Test",
trusted_connection = 'yes')

# SQL Command to read the data
sqlQuery = "select * from dbo.SalesOrder where Region = 'South'"

# Getting the data from sql into pandas dataframe
df = pd.read_sql(sql = sqlQuery, con = connection)

# Export the data on the Desktop
df.to_csv(os.environ["userprofile"] + "\\Desktop\\PythonScript\\" + "SQL_OrderData_" +
datetime.now().strftime("%d-%b-%Y %H%M%S")
+ ".csv", index = False)

# Display Notifiction to User
notification.notify(title="Report Status!!!",
message=f"Sales data has been successfully saved into Excel.\
\nTotal Rows: {df.shape[0]}\nTotal Columns: {df.shape[1]}",
timeout = 10)
-------------------------------------------------------------------------------------------------------------------

Last Video:

Python Excel Automation: https://www.youtube.com/playlist?list=PLWuFHho1zKhUypUoktw1bzYlBLbBGajNm

Python Teaser: https://youtu.be/_Df5uvqkI5k

Python Pandas Tutorial: https://www.youtube.com/watch?v=2NwUfnKhsuU&list=PLWuFHho1zKhUJpe9WfSyvrrQrzqDErbmv

Python Playlist: https://www.youtube.com/playlist?list=PLWuFHho1zKhWb-f-SJAMUCK--f8PJlG46

Python Data Structure Playlist: https://www.youtube.com/playlist?list=PLWuFHho1zKhVMGPh4dfGhObiABPuzam5E

Python OOPs Playlist: https://www.youtube.com/playlist?list=PLWuFHho1zKhVUW-Pgy0ggu6n5yKFOk_P-

Видео Auto Export Data into Excel from SQL using Python Pyodbc | Python SQL Automation |Task Scheduler #16 канала Programming Is Fun
Показать
Комментарии отсутствуют
Введите заголовок:

Введите адрес ссылки:

Введите адрес видео с YouTube:

Зарегистрируйтесь или войдите с
Информация о видео
24 июля 2021 г. 18:30:01
00:13:21
Другие видео канала
Import Records From CSV File (or any data file) to SQL Server (or any database system) With PythonImport Records From CSV File (or any data file) to SQL Server (or any database system) With PythonHow to Use SQL with Excel using PythonHow to Use SQL with Excel using PythonYou MUST WATCH THIS before installing PYTHON. PLEASE DON'T MAKE this MISTAKE.You MUST WATCH THIS before installing PYTHON. PLEASE DON'T MAKE this MISTAKE.Automatic Export data into Excel from SQL using Python | Task Scheduler | Data Automation #1Automatic Export data into Excel from SQL using Python | Task Scheduler | Data Automation #1Export a Table or Query results from SQL Server to ExcelExport a Table or Query results from SQL Server to ExcelPython Bulk Insert Data From excel to sql server  | Dataframe to SQL Table  | Sqlalchemy EnginePython Bulk Insert Data From excel to sql server | Dataframe to SQL Table | Sqlalchemy EngineAutomate Multiple Sheet Excel Reporting - Python Automation Tutorial | Full Code Walk Through (2019)Automate Multiple Sheet Excel Reporting - Python Automation Tutorial | Full Code Walk Through (2019)Python for Everybody - Full University Python CoursePython for Everybody - Full University Python CourseAutomate Excel With Python - Python Excel Tutorial (OpenPyXL)Automate Excel With Python - Python Excel Tutorial (OpenPyXL)Connect to PostgreSQL from Python (Using SQL in Python) | Python to PostgreSQLConnect to PostgreSQL from Python (Using SQL in Python) | Python to PostgreSQLPython Pandas Tutorial: Importing Bulk CSVs Data Into SQL Server Using Python #17Python Pandas Tutorial: Importing Bulk CSVs Data Into SQL Server Using Python #17How to Send Emails Using Python - Plain Text, Adding Attachments, HTML Emails, and MoreHow to Send Emails Using Python - Plain Text, Adding Attachments, HTML Emails, and MoreHow To Schedule Python Scripts As Cron Jobs With Crontab (Mac/Linux) - Python Task AutomationHow To Schedule Python Scripts As Cron Jobs With Crontab (Mac/Linux) - Python Task AutomationHow I'm Learning CodingHow I'm Learning CodingHow to Automate Excel Reports Using SQL [CSV to SQL to Excel Automation]How to Automate Excel Reports Using SQL [CSV to SQL to Excel Automation]Automate Excel reports with Python | Query database with Pandas | Split and save Dataframe to fileAutomate Excel reports with Python | Query database with Pandas | Split and save Dataframe to filePython - Export all the database tables into multiple excel sheetsPython - Export all the database tables into multiple excel sheetsAdvanced Excel Filtering Across Workbooks Tutorial - Excel Automation with Python SeriesAdvanced Excel Filtering Across Workbooks Tutorial - Excel Automation with Python SeriesHow to build Interactive Excel Dashboard with Python - DashHow to build Interactive Excel Dashboard with Python - DashHow To Automate Excel Using Python | Combine Files & Create Charts 🤓How To Automate Excel Using Python | Combine Files & Create Charts 🤓
Яндекс.Метрика