Help with an Applescript to paste from Google Sheets to Numbers

I found a way to copy from Excel to Numbers using the script. I was wondering what options are available for google sheets. I have the web address that hosts an example data that I'd want to copy A1:G1

https://docs.google.com/spreadsheets/d/1Ie69d2hj-iloJB1oBbWOQcsTKUOSTdW7kefMkU8A 1oE/edit?usp=sharing


Here is the apple script I have working to copy/paste from excel. I'm not strong on website parsing.


set tgtTable to "Copy/Paste" -- change if needed to match table name

set pasteCell to "a1" -- upper left cell of range to place values


tell application "Microsoft Excel"

activate

select worksheet "Sheet1"

select range "a1:h1" of worksheet "Sheet1"

tell application "System Events" to keystroke "c" using command down

tell application "Microsoft Excel"

end tell

tell application "Numbers"

tell front document's active sheet's table tgtTable to set selection range to range pasteCell

activate

delay 0.2 -- vary this if needed

end tell

tell application "System Events" to keystroke "v" using {option down, shift down, command down}

end tell


to getVal(t, valTag)

set text item delimiters to valTag

set item2 to t's text item 2

set text item delimiters to "\" "

set val to item2's first text item

end getVal

iPhone 6s Plus, iOS 10.0.1

Posted on Sep 9, 2018 2:45 PM

Reply

Similar questions

4 replies

Sep 9, 2018 4:39 PM in response to Beh162

Having Google Sheets retrieve JSON data makes a lot of sense. But you probably wouldn't want to go to the trouble of then devising a script to copy from Google Sheets to Numbers, because it's so quick and easy to just do that part manually.


You can just select the data in Google Sheets, type command-c to copy to the clipboard, click once in a cell in a Numbers table, and type command-v to paste.


SG

Sep 9, 2018 5:05 PM in response to SGIII

I actually might not need this if I get the Json converted route, this is just a backup/alternative. Manual would be easy enough, the only problem is the old script used to be run every 2 minutes with another software. So, I was trying to continue that, but manual is always better then nothing at all.

Thank you, as always!

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Help with an Applescript to paste from Google Sheets to Numbers

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.