# Paste clipboard into a table

**URL:** <https://forum.inductiveautomation.com/t/paste-clipboard-into-a-table/8360>\
**Category:** Ignition\
**Created:** [April 24, 2014, 9:08am UTC](https://forum.inductiveautomation.com/t/paste-clipboard-into-a-table/8360 "2014-04-24T09:08:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nadya](https://avatars.discourse-cdn.com/v4/letter/n/ecb155/32.png) [@Nadya](https://forum.inductiveautomation.com/u/Nadya)\
**Post date:** [April 24, 2014, 9:08am UTC](https://forum.inductiveautomation.com/t/paste-clipboard-into-a-table/8360/1 "2014-04-24T09:08:17Z")

</div>

Hi

I want to paste data from excel in a table but I can’t write to the table  
I found different script in the forum [http://www.inductiveautomation.com/forum/viewtopic.php?f=23&t=3762](http://www.inductiveautomation.com/forum/viewtopic.php?f=23&t=3762), its works but I would like copy the data in excel and paste in a table in Ignition  
I modify the script but it doesn’t work

Thank you for your help.  
Nadya

---

<div class="post-metadata">

**Author:** ![Nadya](https://avatars.discourse-cdn.com/v4/letter/n/ecb155/32.png) [@Nadya](https://forum.inductiveautomation.com/u/Nadya)\
**Post date:** [April 25, 2014, 9:50am UTC](https://forum.inductiveautomation.com/t/paste-clipboard-into-a-table/8360/2 "2014-04-25T09:50:48Z")

</div>

I found to paste one row from excel into the table  
but I can’t paste all rows

def doPaste(event):  
from java.awt import Toolkit  
import system  
from java.awt.datatransfer import DataFlavor  
clipboard = Toolkit.getDefaultToolkit().getSystemClipboard()  
contents = clipboard.getContents(None).getTransferData(DataFlavor.stringFlavor)  
print contents  
headers = [“Tag name type”,“DataType”,“OPCServer”,“OPCItemPath”,“HistoryEnabled”,“PrimaryHistoryProvider”,“HistoricalScanclass”,“HistoricalDeadband”]  
data=[]  
text = contents  
line = text.split("\t")  
print line  
word = line  
#print word  
# Add the list as a row of data for our table  
data.append(word)  
event.source.parent.getComponent(‘Table’).data=system.dataset.toDataSet(headers,data)

Tks

---

<div class="post-metadata">

**Author:** ![Nadya](https://avatars.discourse-cdn.com/v4/letter/n/ecb155/32.png) [@Nadya](https://forum.inductiveautomation.com/u/Nadya)\
**Post date:** [April 28, 2014, 8:22am UTC](https://forum.inductiveautomation.com/t/paste-clipboard-into-a-table/8360/3 "2014-04-28T08:22:23Z")

</div>

I found it’s easy

def doPaste(event):  
from java.awt import Toolkit  
import system  
from java.awt.datatransfer import DataFlavor  
clipboard = Toolkit.getDefaultToolkit().getSystemClipboard()  
contents = clipboard.getContents(None).getTransferData(DataFlavor.stringFlavor)  
#print contents  
headers = [“Tag name type”,“DataType”,“OPCServer”,“OPCItemPath”,“HistoryEnabled”,“PrimaryHistoryProvider”,“HistoricalScanclass”,“HistoricalDeadband”]  
data=[]  
text = contents  
print text  
col = text.split("\n")  
for i in col:   
if len(i)!=0 :  
line = i.split("\t")  
print line  
data.append(line)  
event.source.parent.getComponent(‘Table’).data=system.dataset.toDataSet(headers,data)

---

<div class="post-metadata">

**Author:** ![juang](https://avatars.discourse-cdn.com/v4/letter/j/9dc877/32.png) [@juang](https://forum.inductiveautomation.com/u/juang)\
**Post date:** [January 30, 2019, 6:04pm UTC](https://forum.inductiveautomation.com/t/paste-clipboard-into-a-table/8360/4 "2019-01-30T18:04:03Z")

</div>

hi, im trying to use this script. can you please let me know where you put this in order to get it to work from Excel.

i want to past multiple rows into a dataset from Excel
