Need dedicated support? Click here
Need dedicated support?
Click here

ApiRange Delete is not working

I can not use the delete method inside api range.
I am using the collaborate onlyoffice from Kde on
I copy pasted into a new spreadsheet and run it into a macro.
It does create the values but does not delete the one in C4.
Hope there is an easy solution to this problem?
Thanks in advance.

DocumentBuilder version: onlyoffice
Installation method:
OS: Linux: Kde Collaborate

Hello @allon

Please pay attention to the description of the method:

Deletes the Range object.


Name Type Description
shift string Specifies how to shift cells to replace the deleted cells (“up”, “left”).

Basically, it deletes a value from specified range (cell C4 in sample) and replaces it with the value from cell C5 below with value 5.

If your final goal is to remove the value from specified cell or range, then use Clear method instead.

Thanks for your answer. My goal is to remove several rows.
I have a spreadsheet where I want for example to remove rows 2 and 3.
I think that oRange.Delete(“up”); is the right command.
I tryed it on your demo and the 5 initially placed in C4 once the delete(“up”) is done.
On our version from onlyoffice the 5 does not move.

The rest of my macro runs without problem.
Is there a special change to do or should I ask our administrator to update onlyoffice?
Thanks in advance!

Now I see the final goal. Here is a sample on how to achieve it with Delete method combined with GetRows method to select all cells within specified rows:

var oWorksheet = Api.GetActiveSheet();

I’m not quite sure if I understand the part about special change but we recommend using most recent version of the product in general. Please try out this approach and, if something goes wrong, then please update your instance and try again.

The Delete method is definitly not working on our onlyoffice version and it works well on your demo page.
Thanks for the code I will definitly use it as soon as our administrator will have fixed the issue.

1 Like