I found a great video on YouTube about editing Google Sheets in bulk, however the script writes over formulas with cell values. I'd like to have formulas be edited from the master sheet rather than writing over with cell values. Is this possible?


function getdata() {
  var files = DriveApp.getFolderById("FOLDER ID HERE").getFiles()
    while (files.hasNext()) {
      var file = files.next();
      var shoot = SpreadsheetApp.openById(file.getId());

      var sourcesheet = SpreadsheetApp.getActive().getSheetByName("SHEET NAME HERE");
      var sourcerange = sourcesheet.getRange('RANGE HERE');
      var sourcevalues = sourcerange.getValues();

    var destsheet = shoot.getSheetByName('SHEET NAME HERE'); 
    var destrange = destsheet.getRange('RANGE HERE'); 

1 Answer 1


Yes, it's possible. Instead of setValues(sourcevalues) you could use setFormulas(formulas)

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.