简体   繁体   English

例外:访问带有 id google sheet 的文档时服务电子表格失败

[英]Exception: Service Spreadsheets failed while accessing document with id google sheet

I made this simple script for a Google sheet, that runs when there is one of the conditions in the IF.我为 Google 工作表制作了这个简单的脚本,当 IF 中有一个条件时运行。 It worked fine until a few days ago when it started to show the error "Exception: Service Spreadsheets failed while accessing document with id", crazy part is that it actually keeps working but only from row 70 ahead.它工作正常,直到几天前它开始显示错误“异常:服务电子表格在访问具有 id 的文档时失败”,疯狂的部分是它实际上继续工作,但仅从第 70 行开始。 No idea what's going on, I even deleted previous macros on the sheet to see if they were interfering.不知道发生了什么,我什至删除了工作表上以前的宏,看看它们是否有干扰。

function onEdit() {
var archivo = SpreadsheetApp.getActiveSpreadsheet();
var hojaorigen = archivo.getActiveSheet();
var nombreorigen= hojaorigen.getName();
var hojadestino = archivo.getSheetByName("NI/NAHO/DQ");
var celdactiva = hojaorigen.getActiveCell();
var filaactiva = celdactiva.getRow();
var colactiva = celdactiva.getColumn();
var valor = celdactiva.getValue();
var rangoorigen = hojaorigen.getRange(filaactiva, 1,1,21);
var rangodestino= hojadestino.getRange(hojadestino.getLastRow()+1,1)

Logger.log(filaactiva);
Logger.log(colactiva);
Logger.log(valor);

if(filaactiva >= 2 && colactiva == 16 && valor == "DISQUALIFIED"  && nombreorigen == "UPDATED Prototype lead claim") {
  rangoorigen.moveTo(rangodestino);
  hojaorigen.deleteRow(filaactiva);}
  else if (filaactiva>= 2 && colactiva == 16 && valor == "DO NOT CONTACT"  && nombreorigen == "UPDATED Prototype lead claim") {
  rangoorigen.moveTo(rangodestino);
  hojaorigen.deleteRow(filaactiva);
  }
  else if (filaactiva>= 2 && colactiva == 16 && valor == "NOT INTERESTED"  && nombreorigen == "UPDATED Prototype lead claim") {
  rangoorigen.moveTo(rangodestino);
  hojaorigen.deleteRow(filaactiva);
  }
  else if (filaactiva>= 2 && colactiva == 16 && valor == "INVALID NUMBER"  && nombreorigen == "UPDATED Prototype lead claim") {
  rangoorigen.moveTo(rangodestino);
  hojaorigen.deleteRow(filaactiva);
  }
  else if (filaactiva>= 2 && colactiva == 16 && valor == "WRONG NUMBER"  && nombreorigen == "UPDATED Prototype lead claim") {
  rangoorigen.moveTo(rangodestino);
  hojaorigen.deleteRow(filaactiva);
  }
}

The error that shows is the following, but as I said it only occurs when from rows 2 - 69, after that it works fine显示的错误如下,但正如我所说,它只发生在第 2-69 行时,之后它工作正常

在此处输入图像描述

This maybe what you're trying to achieve:这可能是您想要实现的目标:

function oneEdit(e) {
  const sh = e.range.getSheet();
  const name = sh.getName();
  if (sh.getName() == "UPDATED Prototype lead claim" && e.range.rowStart > 1 && e.range.columnStart == 16) {
    if (e.value == "DISQUALIFIED" || e.value == "DO NOT CONTACT" || e.value == "WRONG NUMBER" || e.value == "NOT INTERESTED" || e.value == "INVALID NUMBER") {
      e.range.moveTo(e.source.geetSheetByName("NI/NAHO/DQ"));
      sh.deleteRow(e.range.rowStart)
    }
  }
}

It's hard to say for sure because you have two undefined variable as I said in my comments and getActiveCell() returns and range not an integer or row as I suspect you wanted.很难确定,因为正如我在评论中所说,您有两个未定义的变量,并且 getActiveCell() 返回并且范围不是 integer 或我怀疑您想要的行。 Also please note you cannot run functions like this from the script editor unless you pass them the event object.另请注意,除非您将事件 object 传递给它们,否则您无法从脚本编辑器运行此类函数。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 异常:服务电子表格在访问具有 id 的文档时失败 - Exception: Service Spreadsheets failed while accessing document with id Google Sheet 错误:访问带有 id 的文档时服务电子表格超时 - Google Sheet Error: Service Spreadsheets timed out while accessing document with id 例外:我认为访问带有 id *** / getsheetname() 错误的文档时服务电子表格失败 - Exception: Service Spreadsheets failed while accessing document with id *** / getsheetname()error I think 服务电子表格在访问 ID 为 xxx 的文档时失败 - Service Spreadsheets failed while accessing document with ID xxx 异常:服务电子表格在访问 ID 为 XXX 的文档时超时 - Exception: Service Spreadsheets timed out while accessing document with id XXX 电子邮件中的地理图表 | 访问具有 ID 的文档时服务电子表格失败 | 谷歌表格 - Geo Charts in Emails | Service Spreadsheets failed while accessing document with id | Google Sheets 错误异常:访问具有 ID 的文档时服务电子表格失败 - Error Exception: Service Spreadsheet failed while accessing document with id 错误消息:访问 ID 为 1HjEecpeXGdR3iF_0W6CdLIm-hE-W9tbuxmvtKlte1OY 的文档时服务电子表格失败 - Error Msg: Service Spreadsheets failed while accessing document with id 1HjEecpeXGdR3iF_0W6CdLIm-hE-W9tbuxmvtKlte1OY “访问时服务电子表格失败”(看似)简单的代码 - “Service Spreadsheets failed while accessing” on (seemingly) simple code DocumentApp 服务抛出“服务文档在访问带有 id 的文档时失败”错误 - DocumentApp service throws a “Service Documents failed while accessing document with id” error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM