Kick off the new school year with lessons from our Back to School 2022 collection to help students express themselves, build relationships, and stay organized.

4. Embed an Image in Your Spreadsheet

Playback Speed:

In the last video, you used code to add 1 embedded image to your area guide.

In this video, you will add code that allows users to see a different image for each place in your area guide when they click on a cell with the link.

First, create a column in your area guide for, "Image Links".

You will paste embedded image links for each location in this column of your spreadsheet.

Later, your users will click on this link, and the image will automatically appear in the sidebar.

Open the script editor if it isn’t open already, or if it closed when you refreshed your area guide.

In the code, find the link for the Google Maps image you pasted in the last video.

Then, cut the link from the code.

Highlight the entire link.

Then, right click...

or press Control or Command + X to cut.

Return to your area guide spreadsheet.

Paste the URL into the image link column in the appropriate row.

Return to the script editor.

Delete the single quotation marks that surrounded your link.

Then, in the parentheses, type "spreadsheetapp.getactiverange", and add a set of parentheses.

Type a period after the set of parentheses.

An autocomplete menu appears with more options.

Select Get Display Value...

and add a set of parentheses.

Clicking a cell makes it active.

These instructions tell the computer to return the values contained in the active range of cells and display them in the sidebar. Try it out.

Save your code.

Then, run the onOpen function.

You may need to authorize the code again so your program can read information from the spreadsheet.

Return to the area guide sheet.

Click the cell where you pasted the URL for the image.

Then, use the custom menu to run the program again.

The embedded image reloads in the sheet. Great job!

Next, add another embedded image for a different location in your guide.

Find the location in Google Maps.

Get a street view image.

Get the embedded URL.

Then, copy the URL to the empty cell in the appropriate row in your area guide.

Click the cell with the new link.

Then, use the custom menu to run the program.

Great! Now your program works for any embedded link in the spreadsheet.

If your code didn’t work, don’t worry.

Check your punctuation and capitalization carefully.

Make sure you deleted the image link and the single quotation marks from your code.

If you can’t find the problem, ask a neighbor for help.

In the next video, you will add directions for your users, so they will know how to use your area guide.


  1. Cut the embedded image link from your code.
  2. Paste it into a cell in your area guide sheet.
  3. Add code so that the spreadsheet returns the values in the active range of the spreadsheet.
  • "Happy Alley by Kevin MacLeod" by ( -- Licensed under Creative Commons: By Attribution 3.0 License (