# test to try to load an array of values into a new spreadsheet.

import ezodf
import os
from ezodf import newdoc, Sheet


doc = newdoc(doctype='ods', filename='simple')
doc.sheets += Sheet('Sheet1')

mysheet = doc.sheets[0]

print('doc', doc, 'doc.sheets', doc.sheets)

# create a dataset

tt = ['FPURX', 'VWENX', 'VWELX', 'TIRTX', 'VIDGX']
pp = [23, 71, 42, 29, 145]
print (tt)

for index in range(0, len(tt)):
    print('index ', index, tt[index])
    # now we have an index and a variable accessible...let's see if we can load a spreadsheet cells
    mysheet[index,0].set_value( tt[index])
    mysheet[index,1].set_value( pp[index])
    print ('index, value, cell ', index, tt[index], mysheet[index,0].value, mysheet[index,1].value)

print('check mysheet ', mysheet[0,0].value, mysheet[1,0].value, mysheet[2,0].value)
print('check myvalue ', mysheet[0,1].value, mysheet[1,1].value, mysheet[2,1].value)

# we have created a set of sells in the spreadsheet...try saving.
doc.save()

# ####  HALLELUJAH!
