'Excel sheet generated by pandas cannot open in MS Excel
I generated an Excel file with pandas like this:
df = pd.DataFrame(data=df_data)
writer = pd.ExcelWriter("table.xlsx", engine='xlsxwriter')
df.to_excel(writer, sheet_name='Sheet1', startrow=1, header=False, index=False)
... and that executes without issues. However, when I try to open the Excel sheet with MS Excel cannot open. It says "Excel cannot open the file because the file format or file extension is not valid".
Anyone knows what I'm missing?
Solution 1:[1]
Thanks to @Panagiotis Kanavos, if it is done like this:
df = pd.DataFrame(data=df_data)
df.to_excel("table.xlsx", sheet_name='Sheet1', startrow=1, header=False, index=False)
it works. Thanks!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | MD98 |
