Is it possible to copy range with formating using apps scripts?

Viewed 20

dears I need your support to edit this function as I need to copy data with formatting This is the equation I working on

    function copyRows()
            { 
              var copySheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('sheet1');
              var dataSheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('sheet2');
              var dataRange = dataSheet.getDataRange();
              var dataValues = dataRange.getValues();
        
              for(var i = 1; i < dataValues.length; i++)
              {
                if(dataValues[i][29] === 'done')
                {
                  copySheet.appendRow([dataValues[i][0], 
                                      dataValues[i][1], 
                                      dataValues[i][2], 
                                      dataValues[i][3],
                                      dataValues[i][4]]);
                }
              }
        
              for(var i = 1; i < dataValues.length; i++)
              {
                if(dataValues[i][29] === 'done')
                {
                  var clearRow = i+1;
                  dataSheet.getRange('A' + clearRow + ':AC' + clearRow).clear();
                }
0 Answers
Related