Update normal text style in Google Docs with Apps Script

To create a Google Apps Script that updates all paragraphs styled as “Normal text” in a Google Doc to have a font size of 11 and not be bold, follow these instructions. This script will go through your Google Doc and apply these formatting changes to all paragraphs that are designated as “Normal text.”

  1. Open Your Google Doc: First, open the Google Doc you wish to modify.
  2. Access Script Editor: Navigate to Extensions > Apps Script to open the Apps Script editor.
  3. Replace Script Content: In the Apps Script editor, remove any existing code and paste the following script:
function updateNormalTextParagraphs() {
  var doc = DocumentApp.openById(DOCID);
  var body = doc.getBody();
  var paragraphs = body.getParagraphs();

  paragraphs.forEach(function(paragraph) {
    // Check if the paragraph's heading is NORMAL
    if (paragraph.getHeading() === DocumentApp.ParagraphHeading.NORMAL) {
      // Update the font size to 11 and make sure it's not bold
      paragraph.editAsText().setFontSize(11).setBold(false);
    }
  });
}
  1. Save the Script: Click File > Save, and give your project a suitable name.
  2. Run the Script: To execute your script, click the play/run button (▶️) next to the updateNormalTextParagraphs function. If this is your first time running the script, you will be prompted to authorize it.
  3. Authorize the Script: Follow the on-screen prompts to allow the necessary permissions for your script to run. You might encounter a warning indicating that Google hasn’t verified the app. This is expected for new scripts. To proceed, click on Advanced and then Go to [YourProjectName] (unsafe), and agree to the permissions.

This script will iterate over all paragraphs in your document, and for those with the “Normal text” style, it will set the font size to 11 and ensure that the text is not bold.

It’s important to remember that you’ll need to run this script manually each time you want to apply these formatting changes to your document, as the script does not automatically trigger with text changes or additions.