将图片插入Google文档菜单

时间:2016-03-30 15:26:40

标签: google-spreadsheet-api

我在工具栏上创建了一个新的子菜单。我希望有几个下拉项目,每个项目都有自己分配的图像,这样当有人点击其名称时,驱动器中的关联图像会自动出现在单元格中。我该怎么做呢?这就是我到目前为止所做的:

    function onOpen() {
      var ui = SpreadsheetApp.getUi();
      // Or DocumentApp or FormApp.
      ui.createMenu('Supervisor Signatures')
      .addItem('First item', 'menuItem1')
      .addSeparator()
      .addSubMenu(ui.createMenu('Sub-menu')
          .addItem('Second item', 'menuItem2'))
      .addToUi();
     }

function menuItem1() {
  SpreadsheetApp.getUi() // Or DocumentApp or FormApp.
     .alert('You clicked the first menu item!');
}

function menuItem1() {
  SpreadsheetApp.getUi() // Or DocumentApp or FormApp.
     .alert('You clicked the first menu item!');
}

1 个答案:

答案 0 :(得分:0)

环顾社区,在Using Google Script, how can I insert an image into a table cell?找到了这篇文章。

答案只是提到只是做一个将单元格公式设置为的函数 - =Image(<insert-image-url-here>) getRange(<insert-cell-here>).setFormula();

关于使用云端硬盘中的图片,这里有一个简单快捷的指南Get Images from Google Drive

希望这会有所帮助。祝好运。 :)

相关问题