Imagine a published Google Document. On the bottom I want an "Edit this document" link. Is it possible to do this automatically, somehow? Maybe with a macro or similar?

Edit: Just like on a Wiki page, where one always has an EDIT button to edit the Wiki page.

  • 1
    Do I understand you correctly: you want to automatically create links to the editing view to be visible in published view?
    – dnbrv
    Jan 30, 2012 at 14:36
  • @dnbrv Yes, that is correct. Just like on a Wiki page, where one always has an EDIT button to edit the Wiki page.
    – David
    Jan 30, 2012 at 15:46
  • The link returns "Sorry, the file that you request doesn't exists". Mar 20, 2016 at 15:10

1 Answer 1


Short answer

The "Publish to the web" feature of Google Documents doesn't include an option to add the link to edit the source document so one of the several ways to add the link like Google Apps Script and Google Documents add-on, Google Sites Gadget, JavaScript, etc. should be used.

Extended answer

Since the URL to edit a document has the file ID than the published to the web URL there are lot of ways to add the a link to edit the document at the bottom.

URL of a published to the web Google Document:

URL given by the Share feature: https://docs.google.com/document/d/1ZyU97pNm0wDtOziWKnToUnjtAZarpnny_8eohF8-_F0/edit?usp=sharing

URL given by the Google Drive get a link feature and getUrl() method:

File ID


Considering the above, in certain scenarios could be easier to add the link manually than to automate this task.


The following Google Apps Script snippet adds the URL of the document at the end of it's body.

function appendUrl() {
  var doc = DocumentApp.getActiveDocument();
  var body = doc.getBody();
  var text = 'Edit this document';
  var url = doc.getUrl();

The above is the same than copying the URL of the document and insert an hyperlink at the end of the document.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.