Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

How to Export Sql Server Result to Excel in Python

import pyodbc
import pandas as pd

cnxn = pyodbc.connect(< db details here >)
script = """
SELECT * FROM my_table
"""

df = pd.read_sql_query(script, cnxn)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #How #Export #Sql #Server #Result #Excel #Python
ADD COMMENT
Topic
Name
4+8 =