找不到网站范围的问题脚本功能

时间:2017-05-11 17:36:00

标签: google-apps-script google-sheets

每次我们尝试从Google表格运行脚本时,我们都遇到了错误。

  

无法找到脚本函数testScript

这从一张纸开始,但随后用户使用任何包含脚本的工作表进行报告。脚本,网站设置,人员帐户,权限等没有任何改变。一切都像上周一样,但截至周一,我们无法运行任何脚本。

不幸的是,我问我是否可以在这里分享文件,但是为了保护公司的秘密和内容而被拒绝。

我尝试将工作表复制到我的帐户,将其从权限中解放出来,我得到了相同的结果。我甚至在解决其他问题时在我的帐户上有一个旧版本,但它也会受到影响。

我承认,我不知道如何继续,因为我是一名谦虚的一级IT支持人员。

function testScript() 
{
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var Data = ss.getSheetByName("Data");
  var Analysis = ss.getSheetByName("Analysis");
  var Parameters = ss.getSheetByName("Parameters");
  var Vapor = ss.getSheetByName("User Survey Form");
  var WDevice = ss.getSheetByName("WDevice Qualification and Data Entry Form");
  var Source = ss.getSheetByName("mdevice Qualification Form");

// Verify a testerID has been entered

  var testerIDvalue = Vapor.getRange(4, 7).getValue();
  Logger.log("testerIDvalue= "+testerIDvalue);

  if( testerIDvalue == "" ){
     Vapor.getRange(7,10).setValue("Error: Tester ID can not be blank");
     Logger.log("Exiting, testerID+ "+testerID);
     return;
  };

  Vapor.getRange(7,10).setValue("Working");

  var count = Parameters.getRange(19,4).getValue();
  var lastRow = count+2;
  Logger.log("Data to row: "+lastRow);

  //getRange(row, column)
  //copyValuesToRange(sheet, column, columnEnd, row, rowEnd)

  var date = Vapor.getRange(3, 3).getValue();
  Data.getRange(lastRow,2).setValue(date);  
  Logger.log(date);

  // User Survey Form Data

  var WDeviceID = Vapor.getRange(3, 5).copyValuesToRange(Data, 3, 3, lastRow, lastRow);
  var mdeviceID = Vapor.getRange(3, 7).copyValuesToRange(Data, 4, 4, lastRow, lastRow);
  var testerID = Vapor.getRange(4, 7).copyValuesToRange(Data, 5,5 , lastRow, lastRow);
  var acceptID = Vapor.getRange(5, 7).copyValuesToRange(Data, 6,6 , lastRow, lastRow);
  var mdeviceDate = Vapor.getRange(6, 7).copyValuesToRange(Data, 7, 7, lastRow, lastRow);
  var lPressureModel = Vapor.getRange(7, 7).copyValuesToRange(Data, 8, 8, lastRow, lastRow);
  var lPressureSerial = Vapor.getRange(8, 7).copyValuesToRange(Data, 9, 9, lastRow, lastRow);
  var lPressureProbeModel = Vapor.getRange(9, 7).copyValuesToRange(Data, 10, 10, lastRow, lastRow);
  var lPressureProbeSerial = Vapor.getRange(10, 7).copyValuesToRange(Data, 11, 11, lastRow, lastRow);
  var lPressureCalReqDate = Vapor.getRange(11, 7).copyValuesToRange(Data, 12, 12, lastRow, lastRow);
  var sPressureModel = Vapor.getRange(12, 7).copyValuesToRange(Data, 13, 13, lastRow, lastRow);
  var sPressureSerial = Vapor.getRange(13, 7).copyValuesToRange(Data, 14, 14, lastRow, lastRow);
  var sPressureCalReqDate = Vapor.getRange(14, 7).copyValuesToRange(Data, 15, 15, lastRow, lastRow);
  var ionSurveyModel = Vapor.getRange(15, 7).copyValuesToRange(Data, 16, 16, lastRow, lastRow);
  var ionSurveySerial = Vapor.getRange(16, 7).copyValuesToRange(Data, 17, 17, lastRow, lastRow);
  var ionSurveyCalReqDate = Vapor.getRange(17, 7).copyValuesToRange(Data, 18, 18, lastRow, lastRow);
  var mdeviceSpeed =  Vapor.getRange(18, 7).copyValuesToRange(Data, 19, 19, lastRow, lastRow);
  var mdeviceShielding = Vapor.getRange(19, 7).copyValuesToRange(Data, 20, 20, lastRow, lastRow);
  var peakEnergy = Vapor.getRange(20, 7).copyValuesToRange(Data, 21, 21, lastRow, lastRow);
  var effEnergy = Vapor.getRange(21, 7).copyValuesToRange(Data, 22, 22, lastRow, lastRow);
  var WDeviceShielding = Vapor.getRange(22, 7).copyValuesToRange(Data, 23, 23, lastRow, lastRow);
  var notes = Vapor.getRange(23, 3).copyValuesToRange(Data, 24, 24, lastRow, lastRow);
  var rtssoXRC = Vapor.getRange(25, 7).copyValuesToRange(Data, 25, 25, lastRow, lastRow);
  var shutterinterlockTest = Vapor.getRange(26, 7).copyValuesToRange(Data, 26, 26, lastRow, lastRow);
  var sourceCoverinterlocktest = Vapor.getRange(27, 7).copyValuesToRange(Data, 27, 27, lastRow, lastRow);
  var passwortest = Vapor.getRange(28, 7).copyValuesToRange(Data, 28, 28, lastRow, lastRow);
  var redLEDtest = Vapor.getRange(29, 7).copyValuesToRange(Data, 29, 29, lastRow, lastRow);
  var redLEDblinktest = Vapor.getRange(30, 7).copyValuesToRange(Data, 30, 30, lastRow, lastRow);
  var xonindicatortest = Vapor.getRange(31, 7).copyValuesToRange(Data, 31, 31, lastRow, lastRow);
  var airshottest = Vapor.getRange(32, 7).copyValuesToRange(Data, 32, 32, lastRow, lastRow);


 // User Survey Data

  var FWHS2 = WDevice.getRange(6, 3).copyValuesToRange(Data, 37, 37, lastRow, lastRow);
  var SetRatio1 = WDevice.getRange(7, 3).copyValuesToRange(Data, 38, 38, lastRow, lastRow);
  var slowCounts1 = WDevice.getRange(8, 3).copyValuesToRange(Data, 39, 39, lastRow, lastRow);
  var FWHM2 = WDevice.getRange(6, 4).copyValuesToRange(Data, 40, 40, lastRow, lastRow);
  var SetRatio2 = WDevice.getRange(7, 4).copyValuesToRange(Data, 41, 41, lastRow, lastRow);
  var slowCounts2 = WDevice.getRange(8, 4).copyValuesToRange(Data, 42, 42, lastRow, lastRow);  
  var FWHM3 = WDevice.getRange(6, 5).copyValuesToRange(Data, 43, 43, lastRow, lastRow);
  var SetRatio3 = WDevice.getRange(7, 5).copyValuesToRange(Data, 44, 44, lastRow, lastRow);
  var slowCounts3 = WDevice.getRange(8, 5).copyValuesToRange(Data, 45, 45, lastRow, lastRow);  
  var background = WDevice.getRange(10, 3).copyValuesToRange(Data, 46, 46, lastRow, lastRow);
  var leakage1 = WDevice.getRange(11, 3).copyValuesToRange(Data, 47, 47, lastRow, lastRow);
  var leakage2 = WDevice.getRange(12, 3).copyValuesToRange(Data, 48, 48, lastRow, lastRow);
  var leakage3 = WDevice.getRange(13, 3).copyValuesToRange(Data, 49, 49, lastRow, lastRow);
  var leakage4 = WDevice.getRange(14, 3).copyValuesToRange(Data, 50, 50, lastRow, lastRow);
  var leakage5 = WDevice.getRange(15, 3).copyValuesToRange(Data, 51, 51, lastRow, lastRow);
  var sourceDoseTime = WDevice.getRange(17, 4).copyValuesToRange(Data, 52, 52, lastRow, lastRow);
  var sourceDose = WDevice.getRange(17, 3).copyValuesToRange(Data, 53, 53, lastRow, lastRow);
  var calTime = WDevice.getRange(17, 4).copyValuesToRange(Data, 54, 54, lastRow, lastRow);
  var sourceLeakage = WDevice.getRange(19, 3).copyValuesToRange(Data, 55, 55, lastRow, lastRow);
  var calsperHour = WDevice.getRange(20, 3).copyValuesToRange(Data, 56, 56, lastRow, lastRow);

 // Update Calculations

// Format
  var dmaxcol = Data.getLastColumn();
  Data.getRange(lastRow-1, 1, 1, dmaxcol).copyFormatToRange(Data, 1, dmaxcol, lastRow, lastRow);
  Data.getRange(lastRow,1).setValue(lastRow-1); 

// Calculated Data

//  var WDeviceRadSurveyPass = WDevice.getRange(21, 3).copyValuesToRange(Data, 57, 57, lastRow, lastRow);   (Translate Results to 1/0 format)
  var cell = Data.getRange( lastRow, 57, 1, 1);
  var WDeviceRadSurveyPass = WDevice.getRange(21, 3);
  var cell = Data.getRange(lastRow, 57, 1, 1);
  if( WDeviceRadSurveyPass.getValue() == "Pass") {
    cell.setValue(1);
    }
  else  {
    cell.setValue(0);
    };

          // not needed  var WDeviceLeakagePass = WDevice.getRange(6, 6).copyValuesToRange(Data, 58, 58, lastRow, lastRow);  //No field
          // not needed  var WDeviceMaxBrightPass = WDevice.getRange(6, 6).copyValuesToRange(Data, 59, 59, lastRow, lastRow);  //No field
          // not needed  var WDeviceMaxCountsPass = WDevice.getRange(6, 6).copyValuesToRange(Data, 60, 60, lastRow, lastRow);  //No field
          // not needed  var SourceBrightPass = WDevice.getRange(6, 6).copyValuesToRange(Data, 61, 61, lastRow, lastRow);  //No field


//  var S2RadSurveyPass = WDevice.getRange(21, 3).copyValuesToRange(Data, 62, 62, lastRow, lastRow);  (Translate Results to 1/0 format)
  var cell = Data.getRange( lastRow, 62, 1, 1);
  var S2RadSurveyPass = Source.getRange(23, 3);
  var cell = Data.getRange(lastRow, 62, 1, 1);
  if( S2RadSurveyPass.getValue() == "Pass") {
    cell.setValue(1);
    }
  else  {
    cell.setValue(0);
    };

// not needed  var S2LeakagePass = Source.getRange(6, 6).copyValuesToRange(Data, 63, 63, lastRow, lastRow);  //No field
// not needed  var S2MaxCountsPass = Source.getRange(6, 6).copyValuesToRange(Data, 64, 64, lastRow, lastRow);  //No field

  var EnergyCorrectedDose = Source.getRange(19, 5).copyValuesToRange(Data, 65, 65, lastRow, lastRow); 
  var VolumeCorrectionFactor = Source.getRange(19, 6).copyValuesToRange(Data, 66, 66, lastRow, lastRow);  
  var CountCorrectionFactor = Source.getRange(9,6).copyValuesToRange(Data, 67, 67, lastRow, lastRow);  
  var SourceLeakCalEnergyCorrected = Source.getRange(21, 5).copyValuesToRange(Data, 68, 68, lastRow, lastRow);  
  var SourceLeakSourceIntensityCorrected = Source.getRange(21, 6).copyValuesToRange(Data, 69, 69, lastRow, lastRow);  
  var HourlyCalLeakage = Source.getRange(22, 6).copyValuesToRange(Data, 70, 70, lastRow, lastRow);  

  var BackgroundCorrectedLeakage1 = WDevice.getRange(11, 4).copyValuesToRange(Data, 71, 71, lastRow, lastRow);  
  var BackgroundCorrectedLeakage2 = WDevice.getRange(12, 4).copyValuesToRange(Data, 72, 72, lastRow, lastRow);  
  var BackgroundCorrectedLeakage3 = WDevice.getRange(13, 4).copyValuesToRange(Data, 73, 73, lastRow, lastRow);  
  var BackgroundCorrectedLeakage4 = WDevice.getRange(14, 4).copyValuesToRange(Data, 74, 74, lastRow, lastRow); 
  var BackgroundCorrectedLeakage5 = WDevice.getRange(15, 4).copyValuesToRange(Data, 75, 75, lastRow, lastRow);  

// not needed  var BackgroundCorrectedLeakageMean = WDevice.getRange(6, 6).copyValuesToRange(Data, 76, 76, lastRow, lastRow);   //No field
// not needed   var BackgroundCorrectedLeakageMax = WDevice.getRange(6, 6).copyValuesToRange(Data, 77, 77, lastRow, lastRow);   //No field

  var EnergyCorrectedLeakage1 = WDevice.getRange(11, 5).copyValuesToRange(Data, 78, 78, lastRow, lastRow);  
  var EnergyCorrectedLeakage2 = WDevice.getRange(12, 5).copyValuesToRange(Data, 79, 79, lastRow, lastRow);  
  var EnergyCorrectedLeakage3 = WDevice.getRange(13, 5).copyValuesToRange(Data, 80, 80, lastRow, lastRow);  
  var EnergyCorrectedLeakage4 = WDevice.getRange(14, 5).copyValuesToRange(Data, 81, 81, lastRow, lastRow);  
  var EnergyCorrectedLeakage5 = WDevice.getRange(15, 5).copyValuesToRange(Data, 82, 82, lastRow, lastRow);  

// not needed  var EnergyCorrectedLeakageMean = WDevice.getRange(6, 6).copyValuesToRange(Data, 83, 83, lastRow, lastRow);   //No field
  var EnergyCorrectedLeakageMax = WDevice.getRange(21, 5).copyValuesToRange(Data, 84, 84, lastRow, lastRow);  

  var SourceIntensityCorrectedLeakage1 = WDevice.getRange(11, 6).copyValuesToRange(Data, 85, 85, lastRow, lastRow);  
  var SourceIntensityCorrectedLeakage2 = WDevice.getRange(12, 6).copyValuesToRange(Data, 86, 86, lastRow, lastRow);  
  var SourceIntensityCorrectedLeakage3 = WDevice.getRange(13, 6).copyValuesToRange(Data, 87, 87, lastRow, lastRow);  
  var SourceIntensityCorrectedLeakage4 = WDevice.getRange(14, 6).copyValuesToRange(Data, 88, 88, lastRow, lastRow);  
  var SourceIntensityCorrectedLeakage5 = WDevice.getRange(15, 6).copyValuesToRange(Data, 89, 89, lastRow, lastRow);  

// not needed  var SourceIntensityLeakageMean = WDevice.getRange(6, 6).copyValuesToRange(Data, 90, 90, lastRow, lastRow);   //No field
  var SourceIntensityLeakageMax = WDevice.getRange(21, 7).copyValuesToRange(Data, 91, 91, lastRow, lastRow);  

  var CountCorrectedLeakage1 = Source.getRange(13, 6).copyValuesToRange(Data, 92, 92, lastRow, lastRow);  
  var CountCorrectedLeakage1 = Source.getRange(14, 6).copyValuesToRange(Data, 93, 93, lastRow, lastRow);  
  var CountCorrectedLeakage1 = Source.getRange(15, 6).copyValuesToRange(Data, 94, 94, lastRow, lastRow);  
  var CountCorrectedLeakage1 = Source.getRange(16, 6).copyValuesToRange(Data, 95, 95, lastRow, lastRow);  
  var CountCorrectedLeakage1 = Source.getRange(17, 6).copyValuesToRange(Data, 96, 96, lastRow, lastRow);  

// not needed  var CountCorrectedLeakageMean = WDevice.getRange(6, 6).copyValuesToRange(Data, 97, 97, lastRow, lastRow);   //No field
  var CountCorrectedLeakageMax = Source.getRange(23, 7).copyValuesToRange(Data, 98, 98, lastRow, lastRow);   

 // Store Paramters

  var maxSourceIntensity = Parameters.getRange(3, 4).copyValuesToRange(Data, 101, 101, lastRow, lastRow);
  var maxSourceIntensityFiltered = Parameters.getRange(4, 4).copyValuesToRange(Data, 102, 102, lastRow, lastRow);
  var minSourceIntensity = Parameters.getRange(5, 4).copyValuesToRange(Data, 103, 103, lastRow, lastRow);
  var maxSourceCounts = Parameters.getRange(6, 4).copyValuesToRange(Data, 104, 104, lastRow, lastRow);
  var minSourceCounts = Parameters.getRange(7, 4).copyValuesToRange(Data, 105, 105, lastRow, lastRow);
  var sourceIntensificationFactor = Parameters.getRange(8, 4).copyValuesToRange(Data, 106, 106, lastRow, lastRow);
  var largePressureEnergyCorrection = Parameters.getRange(9, 4).copyValuesToRange(Data, 107, 107, lastRow, lastRow);
  var smallPressureEnergyCorrection = Parameters.getRange(10, 4).copyValuesToRange(Data, 108, 108, lastRow, lastRow);
  var waterChamberEnergyCorrection = Parameters.getRange(11, 4).copyValuesToRange(Data, 109, 109, lastRow, lastRow);
  var leakageLimit = Parameters.getRange(12, 4).copyValuesToRange(Data, 110, 110, lastRow, lastRow);
  var calcMaxSorceIntLeakageLimit = Parameters.getRange(13, 4).copyValuesToRange(Data, 111, 111, lastRow, lastRow);
  var calPerHour = Parameters.getRange(14, 4).copyValuesToRange(Data, 112, 112, lastRow, lastRow);

// Finish Test Script Function
  Vapor.getRange(4, 7).setValue(""); //clear testerID 
  Vapor.getRange(7,10).setValue("Survey Recorded");
  Logger.log(Vapor.getRange(4, 7).getValue()); //Force Sheet Display Update
  Utilities.sleep(2000);
  Vapor.getRange(7,10).setValue("");

 };

0 个答案:

没有答案