0

Getting error "The action you're trying to perform is causing a fatal error and cannot be performed" on this line-

sheet.getRange(m, k, enD, 1).setValues(sheet.getRange(m, k, enD, 1).getValues());

My code has been running without errors for a week but since yesterday I am getting this error randomly. Sometime it works sometime it doesn't. I don't wish to disclose the calculations and that's why I am using this.

Any idea why this is happening? I tried reducing 'enD' values from 40s to 10s or 20s. Doesn't help. Tried splitting the code - read values using getValues() first and then write using setValues but again getting error on getValues() part.

3
  • As an electronics engineer the line you describe is what is called a loop...can you explain what it can be used for? Have you tried to use an array as an intermediate variable? Commented Feb 4, 2013 at 6:57
  • Like I mentioned I am trying to replace the formulas in the cells by their values like we do in excel, copy then pastevalues only. I have tried storing values in an array first and then write it to the cells but the reading 'getValues()' part gives me the same error. Commented Feb 4, 2013 at 7:47
  • what is the exact error message?what values are you passing for Ranger arguments? Commented Feb 4, 2013 at 10:58

1 Answer 1

1

I tried this simple test script to check how it could work and I get this log :

3.141592653589793  =PI()
3.14159265358979  

The script goes like this :

function replaceFormulasByValues() {
  var ss = SpreadsheetApp.getActiveSheet();
  var sel = ss.getActiveRange();
  Logger.log(sel.getValues()+'  '+sel.getFormulas()); // show cell's content (value and formula) 
  sel.setValues(sel.getValues());// this is the same mechanism you use
  Logger.log(sel.getValues()+'  '+sel.getFormulas()); // no formulas anymore
}

So it works as expected doesn't it ?

Sign up to request clarification or add additional context in comments.

1 Comment

My script is now working as expected without me changing anything. May be it was an error from google side.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.