AppsThatDeliver
How-Tos, B2B Software Ratings & Reviews
How to Add Code Block in Google Docs & Google Slides
Code blocks are nested pieces of text that you can insert into your Google Docs by navigating to Insert > Building blocks > Code block > Language.
This feature, however, is only available to Google Workspace Business Standard, Business Plus, Enterprise Standard, Enterprise Plus, Education Standard, Education Plus, and Nonprofit subscribers.
This means that if you do not have a subscription to one of the plans mentioned above, you will be unable to write code directly in your documents, which might be a limitation if you need to work with code frequently.
Fortunately, there is another way to add code blocks in Google Docs: with the help of a free Google Docs add-on.
This tutorial will teach you how to add a code block in Google Docs.
Code Block in Google Docs
To insert a code block in Google Docs, install the “Code Blocks” add-on, add the code to your document, and select it. Then, go to Extensions > Code Blocks > Start and click “Format”.
Step 1: Go to Extensions > Add-on > Get add-ons
The first step is to launch Google Docs and open the document.
Now, from the main menu, pick “Extensions,” then “Add-ons” and finally “Get add-ons” from the drop-down menu.
Step 2: Search for the “Code Blocks” add-on
Enter “Code Blocks” into the search field and hit “Enter” to start the search.
Step 3: Install the add-on
Now, choose the Code Blocks add-on by Alex Forsythe from the search results.
Click the “Install” button to begin installing the add-on.
Step 4: Write the code
Write the code in your document after installing the add-on.
You can skip this step if you already have your code typed.
Step 5: Select the code
Now, with your mouse, select the code.
Make sure that the complete code is selected.
Step 6: Go to Extensions > Code Blocks > Start
It is now time to enable the “Code Blocks” add-on.
To do so, go to the top menu and select “Extensions” then “Code Blocks” and finally, “Start” to enable the add-on.
Step 7: Select a code block theme and click on “Preview”
The “Code Blocks” pane will now appear on the right-hand side of the page.
The code language is set to “Auto,” which we will leave as is because the extension is smart enough to identify the language.
You can also pick the code language from the drop-down box by clicking on the “Language” option.
Choose a code block theme from the “Theme” drop-down menu. There are several themes available, so feel free to explore them all.
After you’ve chosen a theme, click the “Preview” button to get a preview of the code block.
Step 8: Click on the “Format” button
If you like the theme, press the “Format” button to enter the code block into your document.
Google Slides Code Block
To insert a code block in Google Slides, install the “Code Blocks” add-on in Google Docs. Then, select your code, go to Extensions > Code Blocks > Start, and click “Format.” Copy the formatted code block and paste it into your slide.
Here’s how to insert a code block in Google Slides:
- Install the Code Blocks add-on in Google Docs.
- Insert your code in a Google Docs document.
- Select the code with your mouse.
- Go to Extensions > Code Blocks > Start.
- Select the preferred code block theme.
- Click Preview to see how the code will look.
- Click Format if you are satisfied with the theme.
- Copy the code block.
- Go to Google Slides.
- Press Ctrl+V to paste the copied code block.
Author: Shubham Calmblay
Shubham Calmblay, founder of appsthatdeliver.com, has a decade of experience with various Google products. He has authored 1,000+ guides for ATD, published on prestigious tech blogs. His work has garnered recognition from Protocol.com, Leadsbridge.com, MadMobile.com, and numerous other leading publications and corporations.
All Posts by Shubham Calmblay
How to Embed Code in Google Slides
Ever found yourself in a meeting trying to explain a piece of code, wishing you could just show it directly in your Google Slides presentation? You're not alone. The ability to embed code in Google Slides can make your presentations much more dynamic and informative, especially if you're in a tech or educational field.
Today, we're going to walk through the steps to actually embed code in Google Slides. We'll look at some practical methods, tips, and even a few creative workarounds. Whether you're a teacher, a coder, or just someone who loves a good presentation, this guide will have something for you.
Why Embed Code in Google Slides?
Let's start with the basics: why would you want to embed code into your slides in the first place? There are quite a few reasons, actually.
First off, embedding code can be a fantastic way to illustrate a point during a presentation. If you're teaching a class on programming or giving a product demo, having the code right there on the slide helps your audience follow along more easily. It gives them a visual to connect with your verbal explanation.
Moreover, embedding code ensures that everyone is on the same page. If you're presenting to a group of developers, showing the exact code snippet you're discussing can prevent misunderstandings and make sure everyone knows exactly what you're talking about. Plus, it just looks cool, right? There's something satisfying about seeing a neatly formatted block of code in the middle of a slick presentation.
Finally, it can save you time. Instead of switching between your slides and a text editor or IDE (Integrated Development Environment), everything you need is in one place. This keeps your presentation smooth and professional, without any awkward pauses or tech hiccups.
Method 1: Using Google Slides' Built-in Features
Now, let's talk about how you can actually get that code into your presentation. The first method involves using Google Slides' built-in features.
Google Slides doesn’t have a built-in code formatting tool, but you can still add code to your slides with a little creativity. Here’s one way to do it:
- Step One: Open your Google Slides presentation and navigate to the slide where you want to add the code.
- Step Two: Click on “Insert” in the menu, then choose “Text box.”
- Step Three: Draw a text box on your slide. This is where you’ll paste your code.
- Step Four: Go to your code editor, copy the code you want to embed, and paste it into the text box you just created.
- Step Five: Format the text to look like code. While Google Slides doesn’t offer code font options, you can create a similar look by using a monospace font like Courier New.
This method is straightforward and works well for static code. However, it has some limitations, which we’ll discuss in the next section.
Method 2: Using Add-ons
If you’re looking for a more polished look, there are add-ons that can help you embed code in Google Slides. Add-ons are like apps for Google Slides that add extra features and functionality.
One popular add-on for this purpose is Code Blocks. Here’s how you can use it:
- Step One: Open your Google Slides and click on “Add-ons” in the menu bar.
- Step Two: Select “Get add-ons” and search for “Code Blocks.”
- Step Three: Install Code Blocks from the Google Workspace Marketplace.
- Step Four: Once installed, open Code Blocks from the Add-ons menu.
- Step Five: Paste your code into the Code Blocks interface and choose your preferred styling options.
- Step Six: Insert the formatted code into your slide.
The beauty of using an add-on like Code Blocks is that it automatically formats your code, giving it a professional look with syntax highlighting. This makes your presentation not only more visually appealing but also easier to read, especially for technical audiences.
Method 3: Screenshots as a Simple Solution
Sometimes, the simplest solution is the best one. If you’re struggling to get your code looking just right with the methods above, consider taking a screenshot of your code and uploading it as an image in Google Slides.
Here’s how you can do it:
- Step One: Open your code editor and make sure your code is properly formatted and visible on your screen.
- Step Two: Use a screenshot tool to capture an image of your code. On Windows, you can use Snipping Tool or Snip & Sketch. On Mac, you can use Command + Shift + 4.
- Step Three: Save the screenshot to your computer.
- Step Four: Open your Google Slides presentation and navigate to the slide where you want to add the image.
- Step Five: Click on “Insert” in the menu, then choose “Image.”
- Step Six: Upload your screenshot from your computer.
While this method doesn’t allow for interactive code, it’s an easy way to ensure your code looks exactly as it should. Plus, you won’t have to worry about formatting issues that can sometimes arise from copy-pasting text.
Method 4: Embedding Code with GitHub Gists
If your code is hosted on GitHub, you can use GitHub Gists to embed it directly into your Google Slides. This method is particularly useful for sharing code snippets that might change over time, as it allows for easy updates.
Here’s how you can use GitHub Gists:
- Step One: Log in to your GitHub account and create a new Gist. Paste your code into the Gist and save it.
- Step Two: Once saved, you’ll see a unique URL for your Gist.
- Step Three: Copy the URL and go to your Google Slides presentation.
- Step Four: On the slide where you want to embed the code, click “Insert” and select “Link.”
- Step Five: Paste the Gist URL into the link dialog and apply it.
While Google Slides doesn’t support direct HTML embedding, linking to a Gist is a handy workaround. It allows your audience to click the link and view the latest version of your code in their browser.
Method 5: Using Third-Party Tools
For those who need more advanced features, third-party tools can offer a robust solution for embedding code. Tools like CodePen or JSFiddle allow you to create and share live code snippets that can be displayed in your slides via links or embedded frames.
Here’s a quick rundown of how you might use CodePen for this:
- Step One: Create an account on CodePen and start a new pen. Paste your code into the editor.
- Step Two: Customize the pen with CSS or JS if necessary, and save it.
- Step Three: Click on the “Share” button and copy the provided link or embed code.
- Step Four: In your Google Slides, choose “Insert” and then “Link” to paste the URL, or insert the embed code if using an HTML-friendly platform.
Using third-party tools can make your presentation more interactive, allowing viewers to see how your code works in real-time. However, keep in mind that this method requires an internet connection during your presentation.
Method 6: Using Google Sheets for Code Display
Here’s a creative twist: using Google Sheets as a means to display your code in Google Slides. This might sound a bit odd at first, but hear me out!
Google Sheets allows for a more organized way to manage code snippets, especially if you’re dealing with multiple pieces of code. Here’s how you can do it:
- Step One: Open Google Sheets and create a new spreadsheet.
- Step Two: In a cell, paste your code. You can use different cells for different parts of your code, like variables, functions, etc.
- Step Three: Format the text by setting the font to a monospace option, like Courier New, and adjust the cell size for better readability.
- Step Four: Once you’re satisfied with how your code looks, take a screenshot of the part of the spreadsheet displaying your code.
- Step Five: Insert this screenshot into your Google Slides presentation as an image.
This method might not be the most conventional, but it keeps your code organized and easy to transfer. Plus, if you need to update your code, you can simply adjust it in Google Sheets and take a new screenshot.
Method 7: Live Coding Demos with Google Meet or Zoom
Sometimes, the best way to present code is by demonstrating it live. If you’re doing a virtual presentation, tools like Google Meet or Zoom offer screen sharing features that can be used to showcase your coding skills in real-time.
Here’s a quick guide on how to do a live coding demo:
- Step One: Set up a meeting in Google Meet or Zoom and invite your audience.
- Step Two: Prepare your code editor with the code you want to showcase.
- Step Three: Once in the meeting, use the “Share Screen” feature to display your code editor to the audience.
- Step Four: Walk through your code, explaining each section as you go. You can even make changes on the fly to demonstrate different outcomes.
This method is interactive and engaging, allowing your audience to see exactly how the code works. However, it requires a stable internet connection and can be a bit daunting if you’re not used to coding in front of an audience.
Tips for a Smooth Presentation
Whichever method you choose to embed your code, a few tips can help ensure your presentation runs smoothly.
- Practice beforehand: Make sure you know exactly how to navigate your presentation and any tools you’re using.
- Check your formatting: Ensure that your code is readable and properly formatted. Syntax highlighting can help with this.
- Backup your presentation: Save a copy of your presentation offline in case of internet issues.
- Engage with your audience: Ask questions and encourage interaction to keep your audience engaged.
- Have a plan B: Technical difficulties can happen. Have a backup plan, like printed handouts or a secondary device, just in case.
By keeping these tips in mind, you’ll be well-prepared to deliver a successful and informative presentation.
Final Thoughts
Embedding code in Google Slides can transform your presentations, making them more engaging and informative. Whether you use built-in features, add-ons, or third-party tools, each method has its own charm and utility. The key is to find what works best for your style and audience.
Speaking of making things easier, have you heard of Bricks ? It’s an amazing tool that integrates spreadsheets, docs, and presentations all in one. If you’re someone who loves working with spreadsheets but hates the hassle of writing formulas or cleaning data, Bricks AI can do it for you in seconds. Not only that, but it can create visuals based on your spreadsheet data, like dashboards and charts. It’s all connected, making your workflow smoother and more efficient.
Get the spreadsheet powered by AI
You shouldn't have to be a spreadsheet expert to get your work done. Bricks makes it easy to create docs, reports, presentations, charts, and visuals backed by your data.
Share this post:
Other posts you might like, how to mask images in google slides.
How to Hide Slides in Google Slides
How to make a data table in google slides, how to use explore in google slides, how to make a color transparent in google slides, how to rotate slide in google slides, inspiration for every use case.
Get started fast with pre-built templates made by industry experts.
IMAGES