So currently the way my python script assigns values to things is by going into each cell one by one and entering the value.
Is there a function that takes an array and outputs it to the selection/range?
My code is basically a “remove duplicates” solution that I mapped to Shift + Enter.
def RemoveDuplicates(*args):
document = XSCRIPTCONTEXT.getDocument()
sheet = document.CurrentController.ActiveSheet
selection = document.getCurrentSelection()
uniques = []
for c in range(0,selection.Rows.getCount()):
cell = selection.getCellByPosition(0,c)
if cell.getString() not in uniques and len(cell.getString()) is not 0:
uniques.append(str(cell.getString()))
cell.String = ""
if len(uniques) < selection.Rows.getCount():
for u in range(0, len(uniques)):
selection.getCellByPosition(0,u).String = str(uniques[u])
I’ve trolled through the docs but I can’t find anything.