2017-04-10 52 views
0

我想通过使用谷歌脚本删除谷歌电子表格中的特定行。我创建了单独的html页面,以便插入行ID。但是,当我运行程序时,出现此错误。 {“result”:“error”,“error”:{“message”:“找不到方法deleteRow((class))。”,“name”:“InternalError”,“fileName”:“Code” “LINENUMBER”:52, “堆叠”: “\ TAT编码:52(用handleResponse)\ n \ TAT编码:18(的doGet)\ n”}}使用谷歌脚本删除电子表格数据

Here is my source code and I have created java script file in the same folder and external html file 引用 - https://mashe.hawksey.info/2014/07/google-sheets-as-a-database-insert-with-apps-script-using-postget-methods-with-ajax-example/

回答

0

这将删除一行。

function drow() 
{ 
    var sht=SpreadsheetApp.getActiveSheet(); 
    var response = SpreadsheetApp.getUi().prompt('Delete Row', 'Enter Row Number to Delete', SpreadsheetApp.getUi().ButtonSet.OK); 
    var rownum = Number(response.getResponseText()); 
    sht.deleteRow(rownum); 
} 
+0

谢谢你的回答,它工作正常。但我需要通过html网页删除它。而不是在脚本编辑器中运行脚本。有什么办法,我可以通过HTML网页做到这一点。? – dara

+0

[HTML服务:与服务器功能通信google.script.run是一个异步客户端JavaScript API,它允许HTML服务页面调用服务器端Apps脚本函数。](https://developers.google.com/apps -script /引导件/ HTML /通信) – Cooper

相关问题