WordPress Blog Data Synchronization to Google Sheets - n8n Workflow

Use this robust n8n workflow to automatically sync WordPress posts, categories, tags, and media library data into structured Google Sheets for comprehensive SEO analysis and reporting. Deploy these n8n templates easily.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

SEO specialists needing structured content data for analysis.
Content managers requiring a centralized database of all published posts.
Developers looking for robust n8n templates for handling API pagination.
Anyone who needs to integrate their WordPress content management system (CMS) with external reporting tools using n8n.

Overview

Managing and analyzing large volumes of WordPress data can be complex when relying solely on the backend. This advanced n8n workflow solves this challenge by creating a mirror of your critical WordPress blog information—including Posts, Categories, Tags, and Media Library details—directly within a Google Sheets document.

This specific n8n workflow handles complex requirements such as API pagination for posts and media, ensuring that even large blogs are synced completely. The logic uses an upsert approach in the Google Sheets n8n node, meaning it will update existing entries (based on ID) or append new ones, providing a continuous, reliable synchronization solution. This robust n8n automation template is designed for daily or on-demand execution, making your blog data immediately usable for reporting and business intelligence.

How it Works

This comprehensive n8n automation guide explains the multi-stage synchronization process:


  1. Trigger and Initialization: The n8n workflow is activated either via a scheduled Schedule Trigger or a manual Webhook activation. The process starts by setting up crucial pagination variables (e.g., currentpage, perpage) in the initial Variables n8n node.

  2. Posts Sync Loop:

The Loop Vars n8n node increments the page number.
The Get Posts HTTP Request n8n node fetches a page of posts from the WordPress REST API, using Basic Authentication.
The Split Out n8n node separates the array of posts into individual items for processing.
The Update Posts Google Sheets n8n node performs an 'Append or Update' operation on the 'Posts' sheet, matching records based on the post ID.
The If n8n node checks the 'x-wp-totalpages' header against the current page number. If more pages exist, the n8n workflow loops back to Loop Vars to fetch the next set of data.

  1. Categories and Tags Sync (One-off): Once the main post loop completes, the n8n workflow sequentially syncs taxonomy data.

Get Categories and subsequent Update Categories nodes fetch category data and upsert it into the 'Categories' sheet.
Similarly, the HTTP Request (for Tags) and Append or update row in sheet nodes fetch and update the 'Tags' sheet.

  1. Media Sync Loop: A separate loop initializes using Variables2 and Loop Vars2 to handle media pagination.

Get Media fetches attachment details.
Split Out1 processes individual media items.
Update Media Google Sheets n8n node updates the 'Media' sheet with details like URL, dimensions, and post ID.
* If1 ensures the loop continues until all media pages are processed, demonstrating effective use of the If n8n node for flow control.

Installation Guide

To set up this powerful n8n workflow template, follow these steps:


  1. Import: Copy the provided JSON and import it into your self-hosted or cloud n8n instance.

  2. Credentials Setup: You must configure two credential types:

WordPress Basic Authentication: Set up HTTP Basic Auth credentials for your WordPress site. This typically requires an Application Password generated in the WordPress user profile. Assign this credential to the Get Posts, Get Categories, HTTP Request (Tags), and Get Media n8n node instances.
Google Sheets OAuth2 API: Set up credentials for Google Sheets access. This account must have read/write permission to the target spreadsheet.

  1. Google Sheet Preparation: Create a new Google Sheet based on the template linked in the workflow sticky note (if available) or create a sheet with dedicated tabs named 'Posts', 'Categories', 'Tags', and 'Media' matching the column headers expected by the Google Sheets n8n node configurations (e.g., id, slug, title, date).

  2. Customization: Update the Variables n8n node at the start to replace the placeholder base_url (https://ozwebexpert.com/wp-json/wp/v2/posts) with your actual WordPress domain URL.

  3. Activation: Activate the n8n trigger (Schedule or Webhook) to begin the synchronization. Run the n8n workflow manually for the first full sync.

Node Details

This n8n workflow utilizes several key n8n node types to achieve the comprehensive synchronization:

Schedule Trigger / Webhook: These are the primary n8n trigger mechanisms allowing scheduled daily runs or manual execution.
Variables (Set n8n node): Used to initialize and store configuration parameters like API base URL, pagination size (perpage), and the starting currentpage. This simplifies maintenance within the overall n8n template.
Loop Vars / Loop Vars2 (Code n8n node): Essential for handling pagination. This custom code increments the currentpage variable used in the subsequent HTTP Request n8n node, enabling the iteration over multiple pages of results.
Get Posts / Get Media / Get Categories (HTTP Request n8n node): Core functionality for interacting with the WordPress REST API endpoints. Key configuration includes using HTTP Basic Auth and passing query parameters (per
page, page, embed, fields). The Get Posts node specifically captures the total pages header (x-wp-totalpages).
Split Out n8n node: Used after each bulk API request (Get Posts, Get Media, etc.) to transform the single response item containing many records into multiple individual items, allowing the Google Sheets n8n node to process them one by one.
Update Posts / Update Categories / Update Media (Google Sheets n8n node): Configured for the appendOrUpdate operation. The critical setting here is the 'Matching Columns' (id, categoryid, mediaid), which ensures data is synchronized rather than duplicated. This robust n8n node is vital for the sync process.


  • If n8n node: Used for flow control in the pagination loops (If and If1). It compares the current page with the total pages header to decide whether the n8n workflow should terminate the loop or continue to the next iteration via the Loop Vars n8n node.

Related n8n Workflows

Free

Nodes: 9 Nodes
Updated: December 26 2025
View all
Created by

🎯 Digital Marketing & Web Dev Expert | 20+ Years of Results-Driven Experience. Helping businesses reduce ad spend and boost revenue through smart digital strategies.

Featured*