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:
- export some data from a database (Tap Forms) as a CSV file,
- open the CSV file in numbers (Table 1).
- delete the header row,
- create a new table in the active sheet (Table 2),
- get a count of the rows,
- 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