beforePaste coordinate values are incorrect

Tags: #<Tag:0x00007efc6dff1e58>

I am attempting to get the startCol, endCol, startRow, and endRow properties from the coordinates object passed into the beforePaste hook. When observing the endCol and endRow values, regardless of how many rows/columns I paste into, the endCol and endRow values always match the startCol and startRow values.

Here is an example of that logging to console: https://jsfiddle.net/kjay7wsd/1/

Here is what gets passed in through the coordinates object:
beforePasteBug

Hi @mtowery

I agree that it looks confusing. I’ll check that and get back to you after the weekend.

1 Like

Thanks @adrian.szymanski. I’m also curious why the object is an array. Is there a possibility that multiple coordinate objects could get passed back from the event hook callback?

Hi @mtowery

I consulted your issue with my colleague and here’s some ideas.

  • We’d like to know how do you get 0 index for endRow and endCol every time;
  • In order to get more accurate coordinates you can use timeout, like in this example: https://jsfiddle.net/8vsmdfgq/5/
  • Answering your last question. At the moment we are not allowing for copying the areas that are not next to each other, that’s why you get just one object in the array.

Thanks for looking into this @adrian.szymanski. Is the settimeout the intended way to gather that info or should I expect there to be a patch for this in the future?

@mtowery For the time being that’s the best solution as that’s currently not on our roadmap.