mardi 22 octobre 2019

How to fix code to remove formulas but leave values in all sheets APART from those specified

I was hoping to get a quick response to some coding i'm trying to get working. I'm at beginner at JS so any help provided will be greatly received.

I want to remove formulas and paste values in all sheets apart from "Base Data" and "Template".

function myFunction() { var ss = SpreadsheetApp.getActive(); var allsheets = ss.getSheets(); for(var s in allsheets){ var sheet = allsheets[s];

if( (sheet.getSheetName() == "Base Data") || (sheet.getSheetName() == "Template") );`

function removeFormulas() { SpreadsheetApp.getActive().getSheets() .forEach(function (myFunction) { var r = myFunction.getDataRange() r.copyTo(r, { contentsOnly: true }) }) } }

}

The desired outcome would be to leave the formulas in "Base Data" and "Template" alone but for the other tabs to have them removed and the values maintained.

Aucun commentaire:

Enregistrer un commentaire