-1

do any of you know how to create an excel file which can display a table from Sqlite using python?

0

1 Answer 1

1

You can use pandas read_sql_query function with a query and your sqlite connection as arguments

sql_query = pd.read_sql_query (
    'SELECT * FROM YOUR_TABLE',
    conn
)
df = pd.DataFrame(sql_query, columns = ['COL1', 'COL2', 'COL3'])
df.to_excel("YOUR_TABLE.xlsx")

You will also need to install openpyxl with pip to run to_excel

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.