You need to have odfpy and pandas installed. This can be done as follows.

python -m pip install odfpy pandas

Here’s a quick example.

import pandas as pd

excel_writer = pd.ExcelWriter("output.ods")

col1 = [1, 2, 3]
col2 = [4, 5, 6]

df = pd.DataFrame({
    "Col1": col1,
    "Col2": col2,
})

df.to_excel(excel_writer, index=False, sheet_name="Sheet one")

excel_writer.close()

Tags: Excel Pandas