简体   繁体   English

Google Sheet 错误:访问带有 id 的文档时服务电子表格超时

[英]Google Sheet Error: Service Spreadsheets timed out while accessing document with id

I get this error " Service Spreadsheets timed out while accessing document with id ..." every time I run a very simple code, in which I am basically copying data from one google sheet to another using getValues() and setValues() .每次我运行一个非常简单的代码时,我都会收到这个错误“服务电子表格在访问带有 id 的文档时超时......”,其中我基本上是使用getValues()setValues()将数据从一个谷歌表复制到另一个谷歌表。

I don't think it is because of 5M cells limit, because the same exact function is working perfectly fine in another Google Sheet with even bigger size.我不认为这是因为 5M 单元格的限制,因为相同的功能在另一个更大尺寸的Google Sheet 中工作得非常好 So I really don't understand where the problem is.所以我真的不明白问题出在哪里。

I have tried to create an empty GS and run the function, so I am only pulling data without any other calculation, but still, it gives me the same error.我试图创建一个空的 GS 并运行该函数,所以我只是在没有任何其他计算的情况下提取数据,但它仍然给我同样的错误。

Any idea what the reason could be?知道是什么原因吗?

Here the code as reference:这里的代码作为参考:

   function MyFunction(){
      var pm_ss_0 = SpreadsheetApp.openById('...');
      var pm_tab_0 = pm_ss_0.getSheetByName('...');
      var pm_data_0 = pm_tab_0.getDataRange().getValues();
      var target_ss_0 = SpreadsheetApp.getActiveSpreadsheet();
      var target_tab_0 = target_ss_0.getSheetByName('...');
      target_tab_0.clearContents();
      var target_data_0 = target_tab_0.getRange(1, 1, pm_data_0.length,   
      pm_data_0[0].length).setValues(pm_data_0);
      }

I get this error " Service Spreadsheets timed out while accessing document with id ..." every time I run a very simple code, in which I am basically copying data from one google sheet to another using getValues() and setValues() .每次我运行一个非常简单的代码时,都会收到此错误“访问具有id的文档时,服务电子表格已超时...”,其中我基本上是使用getValues()setValues()将数据从一个Google工作表复制到另一个工作表。

I don't think it is because of 5M cells limit, because the same exact function is working perfectly fine in another Google Sheet with even bigger size.我不认为这是由于5M单元数的限制,因为相同的确切功能在另一个尺寸更大的Google表格中也能很好地工作 So I really don't understand where the problem is.所以我真的不明白问题出在哪里。

I have tried to create an empty GS and run the function, so I am only pulling data without any other calculation, but still, it gives me the same error.我试图创建一个空的GS并运行该函数,所以我只提取数据而没有进行任何其他计算,但是,它仍然给我同样的错误。

Any idea what the reason could be?知道原因可能是什么吗?

Here the code as reference:这里的代码作为参考:

   function MyFunction(){
      var pm_ss_0 = SpreadsheetApp.openById('...');
      var pm_tab_0 = pm_ss_0.getSheetByName('...');
      var pm_data_0 = pm_tab_0.getDataRange().getValues();
      var target_ss_0 = SpreadsheetApp.getActiveSpreadsheet();
      var target_tab_0 = target_ss_0.getSheetByName('...');
      target_tab_0.clearContents();
      var target_data_0 = target_tab_0.getRange(1, 1, pm_data_0.length,   
      pm_data_0[0].length).setValues(pm_data_0);
      }

I get this error " Service Spreadsheets timed out while accessing document with id ..." every time I run a very simple code, in which I am basically copying data from one google sheet to another using getValues() and setValues() .每次我运行一个非常简单的代码时,都会收到此错误“访问具有id的文档时,服务电子表格已超时...”,其中我基本上是使用getValues()setValues()将数据从一个Google工作表复制到另一个工作表。

I don't think it is because of 5M cells limit, because the same exact function is working perfectly fine in another Google Sheet with even bigger size.我不认为这是由于5M单元数的限制,因为相同的确切功能在另一个尺寸更大的Google表格中也能很好地工作 So I really don't understand where the problem is.所以我真的不明白问题出在哪里。

I have tried to create an empty GS and run the function, so I am only pulling data without any other calculation, but still, it gives me the same error.我试图创建一个空的GS并运行该函数,所以我只提取数据而没有进行任何其他计算,但是,它仍然给我同样的错误。

Any idea what the reason could be?知道原因可能是什么吗?

Here the code as reference:这里的代码作为参考:

   function MyFunction(){
      var pm_ss_0 = SpreadsheetApp.openById('...');
      var pm_tab_0 = pm_ss_0.getSheetByName('...');
      var pm_data_0 = pm_tab_0.getDataRange().getValues();
      var target_ss_0 = SpreadsheetApp.getActiveSpreadsheet();
      var target_tab_0 = target_ss_0.getSheetByName('...');
      target_tab_0.clearContents();
      var target_data_0 = target_tab_0.getRange(1, 1, pm_data_0.length,   
      pm_data_0[0].length).setValues(pm_data_0);
      }

I solved the issue inserting a flush before and after the line where the error appeared.我解决了在出现错误的行前后插入冲洗的问题。

SpreadsheetApp.flush();
ss.insertSheet("Report "+fogl.getName(), ss.getNumSheets()); //line with the error in my code //与我的代码中的错误一致
SpreadsheetApp.flush();

暂无
暂无

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

相关问题 例外:访问带有 id google sheet 的文档时服务电子表格失败 - Exception: Service Spreadsheets failed while accessing document with id google sheet Google Sheet 脚本错误:“服务超时:电子表格”。 如何优化 Google Apps 脚本 - Google Sheet script Error : “Service timed out: Spreadsheets”. How to optimize the Google Apps Script 电子邮件中的地理图表 | 访问具有 ID 的文档时服务电子表格失败 | 谷歌表格 - Geo Charts in Emails | Service Spreadsheets failed while accessing document with id | Google Sheets 例外:我认为访问带有 id *** / getsheetname() 错误的文档时服务电子表格失败 - Exception: Service Spreadsheets failed while accessing document with id *** / getsheetname()error I think 错误消息:访问 ID 为 1HjEecpeXGdR3iF_0W6CdLIm-hE-W9tbuxmvtKlte1OY 的文档时服务电子表格失败 - Error Msg: Service Spreadsheets failed while accessing document with id 1HjEecpeXGdR3iF_0W6CdLIm-hE-W9tbuxmvtKlte1OY 随机异常 - Google Apps 脚本中的“服务超时:电子表格” - Random Exception - “Service timed out: Spreadsheets” in Google Apps Script 错误异常:访问具有 ID 的文档时服务电子表格失败 - Error Exception: Service Spreadsheet failed while accessing document with id 如何使用clearContent()修复“服务超时:Spreadsheets”错误的简单脚本? - How to fix 'Service timed out: Spreadsheets' error for simple script using clearContent()? DocumentApp 服务抛出“服务文档在访问带有 id 的文档时失败”错误 - DocumentApp service throws a “Service Documents failed while accessing document with id” error 服务错误:Google Scripts 上的电子表格 - Service Error: Spreadsheets on Google Scripts
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM