Reputation: 403
I am trying to convert an ODS file to XLSX/CSV using Python. The code snippet is shown below:
import odf
import pandas as pd
pd.read_excel("filename.ods")
The file gets converted to a Pandas data frame, however, all the column entries are NaN. Further, the column names appear as "unnamed 1", "unnamed 2", etc., instead of the column names contained in the original ODS file. Is there a way to resolve this issue?
A snapshot of the data is included below.
Upvotes: 1
Views: 264
Reputation: 14958
I created a (simple) example, and cannot reproduce the problem.
import odf
import pandas as pd
xls = pd.read_excel("filename.ods",engine="odf")
xls.to_excel("filename.xlsx")
My conclusion (from this) is that more debugging info about your .ods
file is needed to reproduce, and solve, this problem.
Upvotes: 0