Is there a way I can programmatically paste into the handsontable like you can for copying?

Tags: #<Tag:0x00007f8b2b15f8e8>

Just like you can for copying using getPlugin(‘CopyPaste’).copy(), can you do the same for paste? I tried getPlugin(‘CopyPaste’).paste() and it doesn’t work.

Hi @vtruong74

Pasting is a little bit more complicated. Please take a look at this tutorial https://docs.handsontable.com/pro/1.15.1/demo-copy-paste.html

EDIT: Thanks. What can I do so that upon button click and without selecting any cells, it will paste into the table (a selection that I’ll determine in the beforeCopy hook), my data that I have copied. Is this possible?

You need to have anything selected as a target. You can always programmatically select a cell or range via selectCell method.

Thanks, I got it pasting but unfortunately I have to set the paste value myself which is contrary to what I want. I’m want to be able paste whatever is in my clipboard content’s on button click. Is that possible? Or due to security reasons and nature of web browser, am I not allowed access to clipboard content through the way that I want?

Hi @vtruong74

I can see that you understand the problem very well. Due to security reasons, reading from the clipboard is not possible that is why the paste button doesn’t work from external data sources. Most of the bigger solutions like Kendo or FlexGrid also do not allow to paste data from an external data source.

Ok, good to have explicit confirmation. Thanks for the help!

1 Like

you’re welcome @vtruong74