Google Drive is an online file sync service.
Drafts has a action to “Save to Google Drive” which writes to the /Drafts folder of your Google Drive. You can also make your own actions to create, append or prepend drafts to any plain text files in your Google Drive using “Google Drive Actions”.
NOTE: Google Drive Actions are only for manipulating plain text files at this time. We are researching adding support for Spreadsheets and Documents in the future, but they are require separate APIs and our out of the scope of these actions at this time.
Before running and Google Drive actions, you will be required to authenticate with Google to allow access to Google Drive. Visit Settings > Accounts > Google Drive to link your Drive account.
To add a Google Drive Action, open Drafts “Settings” , then tap “Google Drive Actions” in the Custom Actions section. Then configure these values:
- Name: The label that will appear in the action list.
- Parent: If blank, the action will target a file in the root of your Google Drive, you can also give the name of a folder at the root level, if the folder does not already exist, it will be created the first time you use the action. Currently Google Drive actions can only write to the root or folders directly in the root of your Google Drive, not in deeply nested folders. Tags can be used to dynamically name parents.
- File: The name for the file. Tags can be used to dynamically name files.
- Ext: The extension to use. Typically “txt”, “markdown”, but can be anything.
- Write: One of four possible output strategies:
- Create: Write to a new file each time the action is used. If a file with the same file name exists already, a second will be created with the same name (Google Drive allows duplicate file names).
- Append: Add to the end of a file.
- Prepend: Add to beginning of a file.
- Replace: Similar to “Create”, but instead of creating a new file if the file already exists, this will completely replace the contents of the existing file with the output of the action.
- Template: Defaults to the tag [[draft]], which will be the content of the current draft. Several tags are supported to add timestamps, but any other text – such as separator lines – can be added as well. Read more about supported template tags.
- Prepend/Append actions may become somewhat inefficient if the target file becomes very large.
- If you want to find a starting place for your action, some importable samples are available at the Drafts Action Directory.