GenAI Secret Sauce for Google Docs Professional Formatting and Infographics

Format every heading, table, and list automatically, then let GenAI create the infographics.
GenAI Secret Sauce for Google Docs Professional Formatting and Infographics

On this page

You asked AI to write a comprehensive report, and it delivered. Sharp, clear, well-organized. But when you look at the Google Doc itself? Formatting chaos. Plain tables. Dense text with nothing to break it up. AI gave you great content wrapped in an ugly package.

Sound familiar?

Sure, Google Docs has custom styles. You can manually set up heading formats, adjust spacing, and style your tables cell by cell. But here's the problem: it's tedious, time-consuming, and easy to miss things.

Wouldn't it be nice if you could have your docs beautifully formatted in one click?

But Wait There's More...

Google Doc writers typically overlook that walls of text, no matter how well-formatted, are hard to absorb. Studies consistently show that visuals help readers understand and retain information better. A well-placed infographic can turn a confusing process into an obvious flowchart, or make abstract statistics suddenly click.

But creating custom infographics is expensive and time-consuming. You either need design skills, expensive tools, or a budget to hire someone. So most documents go without.

What if AI could analyze your content, figure out which sections would benefit from a visual, and generate a custom infographic that actually matches what you wrote?

Now it can.

Introducing the Infographic Generator & Book Formatter

I built a Google Apps Script that solves both problems at once:

  1. One-click document formatting — Transform any Google Doc into a professionally styled document with consistent headings, body text, tables, lists, and links
  2. AI-powered infographic generation — Gemini analyzes your content, identifies sections that would benefit from visuals, and generates custom infographics—flowcharts, timelines, comparisons, statistics, concept maps that help your readers actually absorb the concepts

Think of it as the styling layer that Google Docs' AI is missing, plus a visual content generator that reads your document and creates graphics designed specifically for your ideas.

Example Before:

Example After:

What It Does

One-Click Document Formatting:

Once the document is polished, turn the content into a presentation.

  • Automatically applies consistent styles to every heading, paragraph, list, and table in your document—no manual selection required
  • Styles H1-H5 headings with proper hierarchy, visual markers (like ┃ for H1 and → for H2), colors, and spacing
  • Formats body text with your chosen font and optimal line spacing
  • Transforms plain tables into professional ones with dark header rows, alternating row colors, proportional column widths, and subtle borders—something Google Docs can't do natively with one click
  • Auto-bolds definition terms in lists (text before : or -)
  • Resizes images to full page width
  • Restores link formatting that often gets stripped during import

AI-Powered Infographic Generation:

  • Analyzes your entire document to identify sections where visuals would help readers grasp complex concepts
  • Determines optimal scope: document-wide overview, multi-section summary, or single-section deep dive
  • Generates custom infographics using Gemini's image generation—flowcharts for processes, timelines for sequences, comparisons for options, statistics for data
  • Automatically embeds them at full page width with captions, right where they'll have the most impact
  • Optionally includes your logo in every infographic for consistent branding

The infographics aren't generic stock images. They're custom visualizations generated from your content, designed to help your readers understand and remember what they've read.

How to Install (5 Minutes)

Step 1: Get the Script

  1. Download or copy the script from the GitHub repository:
GitHub - jazmy/jazmy-genai-googledoc-formatter
Contribute to jazmy/jazmy-genai-googledoc-formatter development by creating an account on GitHub.

Step 2: Add to Your Google Doc

  1. Open any Google Doc you want to format
  2. Go to Extensions → Apps Script
  3. Delete any existing code in the editor
  4. Paste the entire contents of InfographicGenerator.gs
  5. Click the Save icon (or press Ctrl/Cmd + S)
  6. Close the Apps Script tab and refresh your Google Doc

Step 3: Set Up Your API Key (For Infographics)

If you want to generate AI-powered infographics, you'll need a free Gemini API key:

  1. Visit Google AI Studio
  2. Sign in with your Google account
  3. Click Create API Key
  4. Copy the key
  5. In your Google Doc, go to 🎨 Infographic Generator → Set API Key
  6. Paste your key and click OK

How to Use It

After refreshing your Google Doc, you'll see two new menus:

🎨 Infographic Generator

Menu Item

Description

Generate →


Smart Analysis (Recommended)

Analyzes entire document holistically, determines optimal infographic placement (document-wide, multi-section, or single-section), then generates and embeds all

Per-Section Only

Analyzes each section independently, generates infographics only for individual sections that need visuals

Document Summary Only

Creates a single executive overview infographic at the beginning of the document

Analyze Document (Preview)

Shows what infographics would be generated without actually creating them - lets you review the plan first

Set API Key

Prompts you to enter your Gemini API key (stored securely in script properties)

Help

Displays help information about the infographic generator

📄 Book Formatting

Menu Item

Description

Format Everything (Fresh)

Full document format - applies base font globally first, then formats all elements. Fastest for first-time use

Format Everything (Resume)

Checks each element before formatting, skips already-formatted ones. Use if interrupted mid-process

Individual Formatters →


Format H1 Headings

Adds red vertical bar prefix (┃), primary font 22pt, bold, dark text

Format H2 Headings

Adds arrow prefix (→), primary font 20pt, bold, red text

Format H3 Headings

Primary font 18pt, bold, dark gray text

Format H4 Headings

Secondary font 16pt, normal weight (not bold), dark gray

Format H5 Headings

Primary font 14pt, bold, dark gray

Format Body Text

Primary font 11pt, charcoal color, 1.15 line spacing

Format Lists

Compact spacing (0 before/after), auto-bolds text before colons or dashes

Format Tables

Dark header row, alternating row colors, proportional column widths, subtle borders

Format Links

Restores blue color (#1155CC) and underline to all hyperlinks

Utilities →


Resize Images to Full Width

Scales all images to 1200pt width while maintaining aspect ratio

Bold List Terms

Bolds text before : or - in list items (for definition-style lists)

Promote Headings (H2→H1, etc.)

Moves all headings up one level (H2→H1, H3→H2, H4→H3, H5→H4)

Remove Horizontal Lines

Deletes all horizontal rules and dash/underscore lines

Remove HTML Comments

Removes paragraphs that are <!-- comment --> format

Remove Bookmarks

Deletes all bookmarks from the document

Preview (First 5) →


Preview All Formatting

Formats only the first 5 of each element type - lets you check styling before full run

Preview Tables Only

Formats only the first 5 tables

Help

Displays help information about book formatting options and current font settings

Customization: Make It Yours

Everything is configurable at the top of the script. No coding knowledge required, just change the values:

Fonts

const FONTS = {
  PRIMARY: 'Google Sans Text',    // Main font for headings and body
  SECONDARY: 'Montserrat',        // Accent font (used for H4)
  CODE: 'Roboto Mono',            // Monospace font for code
};

Colors

const COLORS = {
  PRIMARY_ACCENT: '#B4007D',      // Deep magenta
  SECONDARY_ACCENT: '#7B2D8E',    // Rich purple
  EMPHASIS: '#E50914',            // Red
  // ... and more
};

Branding

const BRANDING = {
  INCLUDE_LOGO: true,
  LOGO_URL: 'https://your-site.com/logo.png',
  LOGO_POSITION: 'bottom-right corner'
};

Want to use your company's brand colors? Swap the hex codes. Prefer a different font? Change the name. The script handles the rest.

Get Started

The full source code is available on GitHub:

GitHub - jazmy/jazmy-genai-googledoc-formatter
Contribute to jazmy/jazmy-genai-googledoc-formatter development by creating an account on GitHub.

Clone it, fork it, customize it for your brand. If you build something cool with it, I'd love to hear about it.

Member discussion

Subscribe to GenAI Secret Sauce newsletter and stay updated.

Don't miss anything. Get all the latest posts delivered straight to your inbox. It's free!

By subscribing, you agree to our Privacy Policy and Terms. We track email opens and clicks. Unsubscribe anytime.

Great! Check your inbox and click the link to confirm your subscription.