Search This Blog

2023/10/01

Python:read ods file

 import pandas as pd


df = pd.read_excel('namelocation.ods', engine='odf')

rows = len(df.index)
cols = len(df.columns)

header = list(df.columns.values)

for head in range(len(header)):
print(header[head] + " ",end=" ")

print()

for row in range(rows):
for col in range(cols):
print(df.iat[row, col] + " ",end="")
print()


# pip install pandas
# pip install odfpy

No comments:

Post a Comment