add or remove row chop execute python

hello all,
it a sample question if you know python. (I think)
I want to add and remove row from a DAT table with a chop execute.
I have try this syntax but it not working.

#to remove the first row
op('name of the table window ').remove_row(0)
op('name of the table window ').removerow(0)

#to add the number 2 to a new row at the end of the table
op('name of the table window').appendRow([2])[/code]

My next step will be : 
to check the number of row [code]
op('table1').numRows

if it below 4 add row
else op('button').click()

I am looking for information to complete the puzzle.
If i am unclear let me know will try to reformulate my question.
Thanks in advance :smiley:

I think part of what you’re after might be found here:

[url]https://matthewragan.com/2014/03/05/touchdesigner-these-are-the-dats-youve-been-looking-for/[/url]

You can also take a look at the python documentation for table DATs here:
[url]http://www.derivative.ca/wiki088/index.php?title=TableDAT_Class[/url]

The syntax for this would be something like:

[code]# delete a row in position 2
target_pos = 2
op( ‘your_target_table_dat’ ).deleteRow( target_pos )

add a row to the bottom

vals = [ 1, 2, 3, 4 ]
op( ‘your_target_table_dat’ ).appendRow( vals )

insert a row at position 2

vals = [ 1, 2, 3, 4 ]
op( ‘your_target_table_dat’ ).insertRow( vals, 2 )[/code]

thanks
for all the info
i will be able to make it work
and i will read your blog post