Numbers - how to populate data from one numbers table to another

I wish to copy the values from one table in a Numbers sheet and put them into another table, but do not know how to implement the copying of the data from one table to another. Is a repeat statement needed? I have seen the examples at https://iworkautomation.com/numbers/table-populate.html and https://iworkautomation.com/numbers/table-read-file.html but they start at too an advanced level for me.

Any help would be gratefully received.

The workflow is:

  1. export some data from a database (Tap Forms) as a CSV file,
  2. open the CSV file in numbers (Table 1).
  3. delete the header row,
  4. create a new table in the active sheet (Table 2),
  5. get a count of the rows,
  6. go through all the rows of Table 1 and take the value of each cell and put them into Table 2

This is not the actual workflow but it is just a simplified example so I can understand how to do it. I can do 1 to 4 in the list, but I am stuck on 5.

The CSV file is in the following format:

As far as I have go with the AppleScript:

set Tap_Forms_file to (path to documents folder as text) & "Notarised documents.csv"

tell application "Numbers"
	activate
	open alias Tap_Forms_file
	tell document 1
		tell sheet 1
			tell table 1
				delete the first row
				set vcount to the count of rows
			end tell
		end tell
	end tell

	set the columnCount to 4
	set the rowCount to 6
	tell application "Numbers"
		activate
		if not (exists document 1) then error number -128
		tell document 1
			tell active sheet
				set thisTable to make new table with properties {column count:columnCount, row count:rowCount}
			end tell
		end tell
	end tell
end tell



Model: iMac 2017
AppleScript: 2.11
Browser: Safari 605.1.15
Operating System: macOS 12

Here is how you can grab the values from a range in table 1 and enter them into a range in table 2 (of the same sheet):


tell application "Numbers"
	set d1 to document 1
	set s1 to sheet 1 of d1
	set t1 to table 1 of s1
	set t2 to table 2 of s1
	
	tell t1
		set ab to value of cells of range "A2:D8"
	end tell
	
	tell t2
		set cd to cells of range "A2:D8"
		repeat with i from 1 to count of cd
			set value of item i of cd to item i of ab
		end repeat
		
	end tell
end tell

Browser: Firefox 101.0
Operating System: macOS 10.12