Python Forum

Full Version: Modify LibreOffice's ods spreadsheet
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,

Here is a snippet on how to access rows in the worksheet.
The type of the "rows" object is odict_values.
Converting it to a list (i.e. list(rows)) results in a list within a list, e.g. [[['aaa', 'rrr'], ['bbb', 'ztutrutr'], ['cccc', 'zuzu'], ['ddd']]].
Is there a smart way to access spreadsheet content to avoid quite large list processing.
Thanks.

from pyexcel_ods3 import save_data
from pyexcel_ods3 import get_data
path = '/.../test.ods'
data_in = get_data(path)
rows = data_in.values()
for row in rows:
    print(row)