Home > Back-end >  GetValues SetValues Basic Syntax Question
GetValues SetValues Basic Syntax Question

Time:12-04

I want eliminate formula information that is in an array of cells. My idea was to get the values of the cells as an array and then set the values back into the same place. I can't get it to work and have a feeling it due to my syntax. Any suggestions?

function getset() {
  var ss = SpreadsheetApp.getActive();
  var lr = sh.getLastRow();
  var places = ss.getRange(2,11, lr-1).getValues();
  ss.getRange(2,11, lr-1).setValues(places);
 }

CodePudding user response:

This works for me

function getset() {
  var ss = SpreadsheetApp.getActive();
  const sh = ss.getActiveSheet();
  var lr = sh.getLastRow();
  var places = sh.getRange(2,11, lr-1).getValues();
  sh.getRange(2,11, lr-1).setValues(places);
 }
  • Related