1

I would like to put a condition if a range of cells is empty. All the cells must be strictly empty. So I tried this :

if ( bottomcolumn.getValues() == '') {

(upcolumn is a variable range i created)

It does'nt work. I think i didn't well understand the google user guide... Any ideas ?

Thank you for reading...

Porto77
  • 37
  • 6
  • 1
    How about [Range.isBlank()](https://developers.google.com/apps-script/reference/spreadsheet/range#isBlank())...Returns true if the range is totally blank. – Cooper May 05 '20 at 21:20
  • You're right... Thank you Cooper :) I was looking for some complicated solutions... – Porto77 May 07 '20 at 16:54

1 Answers1

1

try do see what bottomcolumn.getValues() actually returns and then work from there, I assume it may be null or undefined.

So do this to understand what it outputs:

console.log( bottomcolumn.getValues() ) 

and then for your condition just check if it is a falsy value, such as 0, null, undefined, empty string, etc…:

if( !bottomcolumn ){
  // do something
}
Neven Subotic
  • 1,399
  • 1
  • 6
  • 18