I understand that it may not be the best routine, and there is an overwriting risk. But in my case, I just wan´t to do it (if it is possible, this is just what I am looking for).
It is fun for me to control cells by writting python code directly into cells. And all that just works perfectly fine right now! Except clearing cells…
For example:
This works perfectly fine (assigning values to cells):
doc = XSCRIPTCONTEXT.getDocument()
doc.Sheets['Sheet1']['A1'].String = 'welcome'
This works perfectly fine (reading values from cells):
doc = XSCRIPTCONTEXT.getDocument()
cell_content = doc.Sheets['Sheet1']['A1'].String
return cell_content
But this does not work (clearing cell value)
doc = XSCRIPTCONTEXT.getDocument()
doc.Sheets['Sheet1']['A1'].String = ''
I just want to know if technically I can do that, as it is only changing a value like in the first example.
The reason I am doing that, honestly, is because formulas that return an array with (CTRL+SHIF+ENTER), can´t be automatically & dinamically resized, and this is bad, this gives you no flexibility in some scenarios.
So, even if that is not recommended, I want to know if it is possible to set a null value to a cell, the same as any other value can be assigned. This will work for my working style and it is fun for me
Thank you guys!
By the way, my temporary solution is this:
doc = XSCRIPTCONTEXT.getDocument()
doc.Sheets['Sheet1']['A1'].Formula = '=""'
It visually works!, but I just don´t like it…