Google Script未按顺序运行

时间:2018-02-27 20:49:07

标签: google-apps-script

我在使用Google Script创建一些功能时遇到了麻烦。我正在尝试查询范围然后复制并粘贴它的值,但是即使我在其间放置一个睡眠计时器,它似乎也不会加载。但是,当我注释掉复制和粘贴时,它会运行。

感谢任何帮助!

function setAndCopy(sheetName){
  var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName(sheetName);
  sheet.getRange("B3:P").clearContent();
  var targetCell = sheet.getRange("B3");
  var formulaString = "=query(Vehicles!A2:AM,\"Select A,B,C,D,E,K where E<>''\")";

  targetCell.setFormula(formulaString);

  Utilities.sleep(10000);

  sheet.getRange("B3:P").copyTo(sheet.getRange("B3:P"),{contentsOnly:true});
}

1 个答案:

答案 0 :(得分:0)

设置公式后尝试添加 void CRingExampleView::OnMouseMove(UINT nFlags, CPoint point) { // TODO: Add your message handler code here and/or call default /* I also tried declaring a new point POINT p and passing that to GetCursorPos(&p), but still now numerical output */ if (GetCursorPos(&point)) { TRACE("X:", point.x); TRACE("Y:", point.y); } CScrollView::OnMouseMove(nFlags, point); } CScrollView::OnMouseMove(nFlags, point); }//end function

SpreadsheetApp.flush();