Insert text into beginning of file saved in iCloud/Document

Struggling trying to create my first action.

I have a .txt file saved in a folder in iCloud Drive. I would like to take the contents of a draft and insert it into the top of the file (i.e., first line of .txt file would always be the most recent addition).

Essentially I would like to replicate the “Append to Dropbox journal” but to a .txt document in iCloud. Is this possible?

That is what the File action step does.

There is an “Append to iCloud Journal” example action which is already configured just like the Dropbox example, but for iCloud.

Thanks for the reply! However, I thought the File action is limited to files within the Drafts folder in iCloud (iCloud/Drafts/user/etc…) whereas I would like to put the file directly in ~/Documents/etc…

Is that possible with the File action step?

Apps can only access files inside their own folder in iCloud Drive. This is an iCloud sandboxing security limitation.

The Export step can write to other locations, but only by manually selecting them in the save dialog - and it cannot append.

Here’s an action that should be capable of this. It works by utilising a combination of shell scripts and Draft’s file manager in the scripting.

Here’s the in action description.

Prepend the content of the current draft to a file path outside the Drafts sandbox, as specified by the tag PATH in this action.


  1. This action will not work on i*OS.
  2. The file to be appended to must already exist.

For the default value of PATH, I’ve just used $HOME/Library/Mobile Documents/com~apple~CloudDocs/Test/example.txt, but it works for the Desktop path, Documents path, etc. You’ll just be prompted to confirm permission for access.

Hope that helps.

Whoa this is perfect, thank you!!