How To Add Code Blocks To Google Docs

If you are a programmer, you probably write code all the time. But what if you want to share your code in a doc file with an explanation? Google Docs can be an easy way to do this. Although Google Docs include a built-in feature of adding Code Blocks, you can easily do it using an add-on.

Introducing the Code Blocks Addon – An Easy Way to Add Code Blocks in Google Docs

The Code Blocks Addon makes it easy to add code blocks in your Google Docs. It automatically detects the language of your code and highlights it accordingly. You can also specify the language manually. The addon also lets you choose the theme for your code block.

How To Use The Code Blocks Addon?

First, we need to install the Code Blocks addon in Google Docs from the Google Workspace marketplace. Here is how to do this:

1. Open a Google Docs document.

2. Click on ‘Extensions’ from the top menu bar. Select ‘Get add-ons’.

3. Search for ‘Code Blocks’ in the search box.

4. Find the right add-on from the list and click on it.

5. Press “Install” to install the addon. Grant the permission by pressing “Continue”.

6. Now you will need to select the email account where you want to install the addon.

7. Press “Allow” to grant the necessary permissions to the addon.

8. The addon is now installed and ready to use!

You can access the addon from the ‘Add-ons’ menu at any time.

How to Insert Codes using the Code Blocks Addon

1. Go to Extensions > Code Blocks > Insert code block.

2. A new window will open up. In this window, you can set the style and language.

If you keep the option auto under language, the addon will automatically detect the language.

4. Now enter the code somewhere in the google document and then highlight/select it with your cursor.

5. Click on the ‘Format’ button from the Code Block’s window.

6. Your code should now be inserted as a code block in your document!

7. You can also edit the code on the code blocks just like you would normally edit the text in the google document.


That’s all there is to it! You can now easily add code blocks in your Google Docs using the Code Blocks addon. Try it out and let us know how it goes!