The Palos Publishing Company

Follow Us On The X Platform @PalosPublishing
Categories We Write About

Auto-publish blog drafts from Google Docs

Integrating Google Docs with your blog platform for automatic publishing of drafts can streamline your content workflow, especially for content teams or solo bloggers managing high volumes of content. Here’s a detailed guide on how to auto-publish blog drafts from Google Docs to a blog platform such as WordPress, Ghost, or Medium using automation tools and APIs.

Why Auto-Publish from Google Docs?

Google Docs is a preferred content creation tool for many writers due to its collaboration features, easy editing interface, and cloud accessibility. However, manually copying and formatting each post for publication is time-consuming and error-prone. Automating the publishing process saves time, ensures formatting consistency, and accelerates the content pipeline.

Tools and Services Required

To set up auto-publishing, you need:

  • A Google account (with Google Docs)

  • A blogging platform (WordPress, Ghost, or Medium)

  • An automation tool (Zapier, Make, or custom scripts using Google Apps Script)

  • Access to the platform’s API (for custom integrations)

Setting Up Automation with WordPress

Using Zapier

Zapier is a no-code automation tool that connects Google Docs with WordPress. Here’s how to configure it:

  1. Create a New Zap:

    • Trigger: New Document in Folder (Google Docs)

    • Action: Create Post (WordPress)

  2. Preparation Steps:

    • Store all your blog draft docs in a specific Google Drive folder.

    • Format your Google Docs with clear structure: Title, H1, H2, paragraphs, images, etc.

  3. Map the Fields:

    • Post title = First line or heading in the doc

    • Post content = Entire body of the document

    • Post status = Draft or Published

  4. Authentication:

    • Connect both your Google Drive and WordPress accounts to Zapier.

    • For WordPress, use application passwords (under WordPress > Users > Profile).

  5. Test and Activate:

    • Run a test with a sample document.

    • Once successful, turn on the Zap to auto-publish future documents.

Custom Integration via Google Apps Script

If you need more control and customization:

  1. Open Google Apps Script Editor:

    • From Google Docs: Extensions > Apps Script

  2. Write Script to Export and Publish:

    javascript
    function publishToWordPress() { const blogUrl = 'https://yourdomain.com/wp-json/wp/v2/posts'; const username = 'yourusername'; const password = 'your-application-password'; const docId = 'your-doc-id'; const doc = DocumentApp.openById(docId); const body = doc.getBody().getText(); const title = doc.getName(); const payload = { title: title, content: body, status: 'publish' }; const options = { method: 'post', contentType: 'application/json', headers: { 'Authorization': 'Basic ' + Utilities.base64Encode(username + ':' + password) }, payload: JSON.stringify(payload) }; UrlFetchApp.fetch(blogUrl, options); }
  3. Trigger the Script:

    • Set up a time-based or folder-based trigger.

    • Scripts can be run manually, scheduled daily, or executed upon document updates.

Setting Up Automation with Ghost CMS

Using Zapier or Make

  1. Trigger:

    • Google Docs > New Document in a Folder

  2. Action:

    • Ghost > Create a Post (via API)

  3. Configuration:

    • Ghost Admin API Key and Integration Setup required

    • Define content structure: Title, HTML body, tags

  4. Convert Google Docs to HTML:

    • Use a Docs-to-HTML parser in Zapier or Google Apps Script

    • Paste converted HTML as html content in Ghost post body

Custom Script via Webhook

  1. Use Google Apps Script to Convert and Send HTML:

    • Convert Google Doc content to HTML using third-party services or custom logic

    • Send POST request to Ghost Admin API /ghost/api/admin/posts/

  2. Authentication:

    • Use Admin API key as JWT (JSON Web Token)

    • Include proper headers for Ghost authentication

Setting Up Auto-Publish to Medium

Using Zapier

  1. Trigger:

    • Google Docs > New Document

  2. Action:

    • Medium > Create a Story

  3. Connect Medium:

    • Use Medium’s integration token

    • Select whether to publish as a draft or live post

  4. Content Mapping:

    • Medium supports HTML and Markdown. Convert Google Docs using markdown tools.

Medium API via Apps Script

  1. Get Medium Integration Token:

    • From Medium’s settings under Integration Tokens

  2. Send a POST request:

    javascript
    function publishToMedium() { const token = 'your-medium-token'; const url = 'https://api.medium.com/v1/users/me/posts'; const doc = DocumentApp.openById('your-doc-id'); const body = doc.getBody().getText(); const title = doc.getName(); const options = { method: 'post', contentType: 'application/json', headers: { 'Authorization': 'Bearer ' + token }, payload: JSON.stringify({ title: title, contentFormat: 'html', content: body, publishStatus: 'draft' }) }; const response = UrlFetchApp.fetch(url, options); Logger.log(response.getContentText()); }

Best Practices

  • Standardize Formatting: Use consistent headers, image placement, and spacing in Google Docs.

  • Document Naming: Include slug or publish date in document name for easier automation.

  • Image Handling: Google Docs-hosted images need to be uploaded to your CMS or a CDN; scripts must handle this.

  • Status Control: Tag documents as “Ready to Publish” or use metadata in the doc for automation filters.

  • Version Control: Use version history in Docs to track edits before auto-publishing.

Security Considerations

  • Use encrypted application passwords or tokens.

  • Never expose API keys in public-facing documents or unsecured scripts.

  • Apply access controls on Google Drive folders to limit unauthorized publishing.

Conclusion

Auto-publishing blog drafts from Google Docs can significantly enhance productivity and reduce manual overhead. With tools like Zapier, Make, or Google Apps Script, you can create a smooth, reliable pipeline from document creation to live publication. Whether you’re using WordPress, Ghost, or Medium, proper setup and formatting standards will ensure a consistent, scalable publishing workflow.

Share this Page your favorite way: Click any app below to share.

Enter your email below to join The Palos Publishing Company Email List

We respect your email privacy

Categories We Write About