且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

通过脚本错误删除Google工作表中的图像

更新时间:2023-12-05 19:38:58

  • 您要使用Google Apps脚本删除电子表格上的图像.
  • 如果我的理解是正确的,我认为delete()可能是新方法,将在不久的将来为电子表格添加.因此,该文档尚未更新,因此可能尚未完成.但是从错误消息中,如果您想使用当前的delete()方法,该示例脚本如何?

    If my understand is correct, I think that delete() might be new method which will be added for Spreadsheet in the near future. So the document is not updated and it might not complete yet. But from the error message, if you want to use the current delete() method, how about this sample script?

var images = sheet.getImages();
var img = images[0];
img["delete"](); // this one

注意:

  • 我认为详细信息可以添加到此文档.
  • 在我的环境中,我可以确认可以通过img["delete"]()删除图像.我认为这是一种新方法.
  • Note:

    • I think that the detail infomation might be added to this document.
    • In my environment, I could confirm that the image can be deleted by img["delete"](). I think that this is one of new methods.
    • 如果我误解了你的问题,对不起.

      If I misunderstand your question, I'm sorry.

      现在为了删除图像,可以使用以下方法.这已在2018年10月13日得到确认.

      Now in order to delete the image, the following method can be used. This was confirmed at 2018 October 13.

var images = sheet.getImages();
var img = images[0];
img.remove(); // Here

于2018年10月31日更新:

此文件于2018年10月30日正式发布.

您可以在 Class OverGridImage 上查看该文档. >.