Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-apps-script/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google apps script 谷歌应用程序脚本可以';无法按所有者运行脚本_Google Apps Script - Fatal编程技术网

Google apps script 谷歌应用程序脚本可以';无法按所有者运行脚本

Google apps script 谷歌应用程序脚本可以';无法按所有者运行脚本,google-apps-script,Google Apps Script,我拥有文档、工作表、幻灯片和表单附加组件的所有者。 我有一个编辑 我尝试以所有者身份运行scriptgoogle.script.run,脚本返回“加载时出错(代码:47)”。 若我尝试以编辑器的形式运行测试脚本,那个么脚本就可以正常工作。 什么是错误代码:47?为什么错误只针对所有者 客户端代码 window.google.script.run .withSuccessHandler(() => { resolve({ success: true }) }) .withFailur

我拥有文档、工作表、幻灯片和表单附加组件的所有者。
我有一个编辑
我尝试以所有者身份运行script
google.script.run
,脚本返回“加载时出错(代码:47)”。
若我尝试以编辑器的形式运行测试脚本,那个么脚本就可以正常工作。
什么是错误代码:47?为什么错误只针对所有者

客户端代码

window.google.script.run
  .withSuccessHandler(() => { resolve({ success: true }) })
  .withFailureHandler((err) => {
    console.log('error', err);
    reject({ reject: true })
  })
  .loadImg({ data: someData })
应用程序脚本代码

function loadImg (params) {
  let docType = null
  if (DocumentApp.getActiveDocument())       docType = 'docs'
  if (SpreadsheetApp.getActiveSpreadsheet()) docType = 'sheets' 
  if (SlidesApp.getActivePresentation())     docType = 'slides' 
  if (FormApp.getActiveForm())               docType = 'form' 

  // Create Blob
  const imgByte = Utilities.base64Decode(params.img)
  const blob = Utilities.newBlob(imgByte, MimeType.PNG, params.name)

  // Append a new Image.
  if (docType === 'docs')   addIconInDoc(blob)
  if (docType === 'sheets') addIconInSheets(blob)
  if (docType === 'slides') addIconInSlides(blob)
  if (docType === 'form')   addIconInForm(blob, params.name)
}

47表示脚本编辑器中的行号。你能确认哪条线路出故障了吗?