I get an Attribute Error with the line:
range.gotoEndOfUsedArea (True)
Combining the two information in 1: http://nab.pcug.org.au/transferdemo_oocalc.py and 2: https://wiki.openoffice.org/wiki/Documentation/BASIC_Guide/Cells_and_Ranges
I came up with the following solution:
def getLastActiveCell(sheet): """returns the last used column and row of the provided sheet (ie the last cell in the range containing something other than '')"""
You can then access these values ββin your code as follows:
lastCell = getLastActiveCell(sheetObject) print lastCell[0]
and create a range
range = sheetObject.getCellRangeByPosition( 0, 0, lastCell[0], lastCell[1] )
or whatever for further work.
source share