Home > Software design >  Script Google Sheets error because cell is empty
Script Google Sheets error because cell is empty

Time:05-01

I tried to take a code and adapt it to my needs but without success because I am a novice in scripting.

This code allows to generate an image of a Google Maps with markers for each address and a line that connects them. At first this code was for 2 addresses that we had to indicate in the code and the generated image was sent by email.

So I rewrote the code (my first one alone) to plot and mark the points of 6 addresses and then have the generated image pasted into a cell of my sheet.

The problem I have is that I get the error "Exception: Invalid argument: address" when at least one of the cells containing the addresses does not contain a value (so the value is an address). I need to add something after the .getValue() function but I can't.

I know that the answer to this question may seem simple to the advanced script users, but also that this code could be useful to others.

Thank you for your insight and indulgence.

My Sheets:

enter image description here

put correct values and let me know if the code works.

CodePudding user response:

The code of soMarios was working nice but markers colors was not correct. Here is the solution from another comunity. I let the code if it can help someone else.

function onOpen() {
  SpreadsheetApp.getUi().createMenu('⇩ M E N U ⇩')
    .addItem('           
  • Related