Hi  scripting community! I’ve almost got it, but I can’t seem to get the data pasted in the right place.
I'm new to applescript and it's my first scripting language. I'm trying to create a script that will copy a block of cells in an excel spreadsheet and paste that info (preferably with a keystroke) into a numbers template. I've written a successful script to activate Excel, go to the sheet with the info, copy it, then open a Numbers template from My Templates. The problem I can't solve on my own is how to select the right cell on the right table on the right sheet and Paste and Match Style.
Some helpful info:
-I’ve changed my [Command+V] keystroke in Numbers to “Paste and Match Style” because this is a very common action for me
-The Numbers template is pretty big, but does open on the correct sheet for the paste
Here’s what I have so far:
tell application “Microsoft Excel”
activate
set myActiveWook to “OG3.9.xls”
select worksheet “Blank1”
select range “E8:E32” of worksheet “Blank1”
tell application “System Events” to keystroke “c” using command down
tell application “Microsoft Excel”
select worksheet “Inputs”
end tell
tell application “Numbers”
activate
set the templatenames to the name of every template
set thistemplatename to “PQ10a” as string
make new document with properties ¬
{document template:template “PQ10a”}
end tell
end tell
From here I was trying this, but couldn’t get it to work. Upon a test run, it would paste the data the first time into the script editor, then in the middle of the template if run a second time. (the first part was I’ll see you there and paste from the web… I’m pretty sure the first three lines can be condensed into one, but don’t know how and hey… this works)
tell application “Numbers”
activate
set the templatenames to the name of every template
set thistemplatename to “PQ10a” as string
make new document with properties ¬
{document template:template “PQ10a”}
tell table “10” of sheet “INPUTS” of document 1
set selectrange to cell “B2”
tell application “System Events” to keystroke “v” using command down
end tell
end tell
Thank you in advance for your help.
Ash