Thanks for the great article!
I fixed some bugs, and put the new version in this Gist.
Note: this version is only for picking files, not folders.
case .files, you want to use
pickedURLto make the document. According to the documentation, “Always use the URL passed into the block instead of the value in the url parameter.”