Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

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
2+6 =