I've a file .ods with 10 rows in each row a number from 0 to 9. I need to assert a certain value for each row like whether this number is even or odd. I wrote some code like this:
import pyexcel_ods as pe
from pyexcel_ods import save_data
from pyexcel_ods import get_data
file = pe.get_data("file.ods")
for row in range (1, 10):
if (row == 2) or (row == 4) or (row == 0):
file.add_column = ["even"]
print ("well done")
sheet.update()
pe.save_data("file.ods", file)
It works well and prints two (well done) statements. But when I open the file after that I didn't find any update ( id doesn't write "even" in the file). How to write this value in certain column for the even numbers? It also deletes any cell with number 0 like in the two images attached:
Before running the script:
After running the script: