Format GSC Data by Page & Query

A powerful Google Apps Script that transforms raw Google Search Console data into beautifully formatted, page-grouped reports. Perfect for content briefs, SEO reports, and identifying optimization opportunities at a glance.

โฌ‡๏ธ Jump to Code Copy

๐Ÿ“„ Group by Page

Automatically organizes queries under their respective pages for easy analysis and reporting.

๐Ÿ“Š Sorted by Impressions

Queries are ranked by impressions (or clicks) so you see the most important opportunities first.

๐ŸŽฏ Gap Score Calculation

Identifies optimization opportunities with a calculated "Gap Score" showing potential for improvement.

๐ŸŽจ Professional Formatting

Creates beautifully styled tables with color-coding, banding, and clear visual hierarchy.

What This Script Does

Understanding the Gap Score

Gap Score Formula:
(Impressions ร— Position รท 10) - Clicks

This metric identifies queries with high visibility (impressions ร— position) but low actual clicks, indicating content optimization opportunities.

Priority Levels:
๐Ÿ”ด HIGH: Gap Score โ‰ฅ 500 (Urgent optimization needed)
๐ŸŸก MEDIUM: Gap Score 100-499 (Consider optimization)
๐ŸŸข GOOD: Gap Score 0-99 (Acceptable performance)
๐Ÿ’ช STRONG: Gap Score < 0 (Outperforming expectations)

How to Use

Step-by-Step Setup:

  1. Prepare Your Data: Export GSC data (or use data from the Winners & Losers tool) with columns: Query, Page, Clicks, Impressions, CTR, Position
  2. Import to Google Sheet: Paste your GSC data into a new Google Sheet with proper headers.
  3. Copy the Script: Click the "Copy Script" button below to copy the entire Apps Script code.
  4. Open Apps Script: In your Google Sheet, go to Extensions โ†’ Apps Script.
  5. Paste the Code: Delete the default code and paste the copied script.
  6. Save and Close: Click Save, then close the Apps Script editor.
  7. Run the Script: Back in your Sheet, refresh the page and go to Extensions โ†’ Macros or use the menu created by the script.
  8. View Results: A new sheet called "Page_Query_Report" will be created with your formatted report.

Customization Options

You can edit these settings at the top of the script:

Copy the Script

Click the button below to copy the entire Apps Script code:

๐Ÿ’ก Pro Tips:
  • Use this script to generate content briefs - organize queries by page and see exactly what to focus on.
  • HIGH priority queries are perfect candidates for title tag and meta description rewrites.
  • Filter by priority level to focus on quick wins during your SEO sprints.
  • The script automatically limits to 20 queries per page to keep reports focused and actionable.
  • Export the final report as a PDF for client presentations and stakeholder updates.