0

My workflow with Google Drive usually begins interacting with my Google Drive filesystem from Finder. When I need to open a file I can open it via Finder (CMD + O), which opens in a browser. I can similarly duplicate, delete, rename, move Drive files via finder. This is great.

But I can't learn how to create a Drive doc from finder easily (ideally with keyboard shortcut), instead I'm forced to go to the web interface and navigate the same filesystem and create it there. It's disruptive to my workflow and seems unnecessary.

I have a very useful shortcut to do this with .txt files. How can I achieve the same for Google Drive documents?

Mack M.
  • 103
  • 1
  • 5
  • Are you simply looking to create a blank file with the default Google Documents name extension of ".gdoc" in Finder, and have that document available locally and on Google Drive on the net? OR… are you looking to do everything I just mentioned… including adding content to the new document (for example adding the content of your clipboard to the new document)? – wch1zpink Feb 09 '20 at 21:27
  • The first thing you mentioned: simply to create a blank file that is Google Drive format (doc or sheet) that is available locally and on Drive. The shortcut I link to in my question actually allows me to create a .txt doc, and I tried creating a fresh .txt doc and changing the suffix to .gdoc but Drive wouldn't recognize it. – Mack M. Feb 10 '20 at 23:04

2 Answers2

1

If you highlight any Google Drive folder or subfolder in your finder and right mouse click you'll get an option to Create New in the menu:

enter image description here

Ruvee
  • 8,611
  • 4
  • 18
  • 44
0

For this to work properly, your front Finder window needs to be opened to the Google Drive folder in which you want your new file created.

1. Open Automator.app and create a new "Quick Action" file

enter image description here

2. Add a "Run AppleScript" action to your workflow and paste this following AppleScript code into your new "Run AppleScript" action.

property tempNameExtension : ".txt"
property finalNameExtension : ".gdoc"
property newFileName : missing value

tell application "Finder" to set finderWindowName to name of Finder window 1

activate
set newFileName to text returned of (display dialog ¬
    "Please Choose A Name For Your New File" default answer ¬
    "New_File_Name" buttons {"Cancel", "Create New File"} ¬
    default button 2 cancel button 1 with title "Please Choose A Name For Your New File")

do shell script "echo ' ' > " & quoted form of finderWindowName & "/" & quoted form of newFileName & tempNameExtension
delay 15 -- Allows Time To Sync Temp File To Google Drive
do shell script "mv " & quoted form of finderWindowName & "/" & quoted form of newFileName & tempNameExtension & " " & quoted form of finderWindowName & "/" & quoted form of newFileName & finalNameExtension

enter image description here

3. Save and name your new file. I saved and named my file "Auto Google.workflow"

4. Open System Preferences and navigate to Keyboard / Shortcuts / Services. Scroll down through all of the services until you locate your new Quick Action which you created, then assign it a new keyboard shortcut.

enter image description here

In short, this Automator quick action will create a new Google documents file with the name extension of "gdoc" with the name you inserted in the dialog pop up, in your Google Drive folder.

Here is a short animation of the process after I pressed my newly created keyboard shortcut.

enter image description here

wch1zpink
  • 3,026
  • 1
  • 8
  • 19
  • Thank you for spending time on this! There must be something I'm missing because when I try to build this workflow in automator, it wont let me save and gives me this error, almost as if it's trying to look for a .txt document with the same name as the workflow (I chose "Create google doc") and can't find one... Screenshot here: https://www.dropbox.com/s/kn2r5z6bdfw41sk/Screenshot%202020-02-10%2017.20.14.png?dl=0 – Mack M. Feb 10 '20 at 23:19
  • I just followed the entire process, again, that I posted in my answer… and I am not getting any errors at all. Make sure you have "Backup and Sync" running and in it’s preferences, make sure that is set to automatically sync everything. If you tried running the workflow first, while not logged into "Backup and Sync" app, when you do finally login… your new file will be rejected by Google Drive. Try pasting only the AppleScript code into a new Script Editor.app document and run the code from there. Let me know if you still get errors. – wch1zpink Feb 11 '20 at 00:28
  • Hm, still getting the same error, although this time I try with the Drive finder window 1st attempt: closed, 2nd attempt: opened to Drive root folder (with auto-syncing on) naming workflow Auto Google, 3rd attempt: same as 2nd attempt but naming the workflow Auto Google.workflow. See video here: https://www.loom.com/share/5a6eebb91c5f46609f292e80fed72039 – thank you for your continued help! – Mack M. Feb 14 '20 at 16:54