将数据从一个Google电子表格复制到另一个

时间:2018-04-12 11:28:27

标签: google-apps-script google-sheets

我已经制作了在 id列的帮助下处理详细信息的脚本,这些脚本在两个工作表中都很常见,此代码不会复制任何细节 with the id i want to copy rest details in another sheet

function myFunction()
{

}
function onOpen() {

  var subMenus = [
                   {name:"Generate farnchise username", functionName: "approveRequests"},
                 ];
    SpreadsheetApp.getActiveSpreadsheet().addMenu("Custom Functions", subMenus);
}

function approveRequests() {
 var ss = SpreadsheetApp.getActiveSpreadsheet()
     sheet = ss.getActiveSheet(),
     sheetName = sheet.getName(),
     data = sheet.getDataRange().getValues();
 if (sheetName == "g6-live-properties") {
  var range = sheet.getActiveRange(),
      startRow = range.getRowIndex(),
      numRows = range.getNumRows(),
      numCols = range.getNumColumns()
  if (numCols == 3) {
   if (data.length > 1) {
    var values = range.getValues(),
        nextSheet = ss.getSheetByName("11-Apr-60+"),
        lastRow = nextSheet.getLastRow();
    nextSheet.getRange(lastRow+1,1,numRows,3).setValues(values);
    sheet.deleteRows(startRow,numRows);
   } 
  } 
 } 
}

0 个答案:

没有答案