You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

切换账号后Google Apps Script部署功能异常求助

Google Apps Script切换工作邮箱后部署报错问题

我正在使用Google Sheet接收表单提交,并通过Apps Script实现自动发送确认邮件的功能。当前用个人邮箱发送确认邮件一切正常,但尝试切换为工作邮箱时,每次点击部署下拉菜单的任意选项都会报错:Something went wrong Please reload the page to try again.

我已经尝试了以下排查操作,但仍无法定位问题原因:

  • 清除浏览器缓存
  • 使用隐身模式访问脚本编辑器
  • 检查编辑器运行状态
  • 确认安全设置中的Apps Script权限

我的代码

var sheetName = 'Sheet1';
var spreadsheetId = '1p_uNtFvZHPdIJetkN-YouPaek4JOg4mFHjqKIFcs-gw';
var flagColumn = 3;  // Use column C as a "trigger flag" column.

function checkForNewSubmission() {
  try {
    var sheet = SpreadsheetApp.openById(spreadsheetId).getSheetByName(sheetName);
    var lastRow = sheet.getLastRow();
    var flagValue = sheet.getRange(lastRow, flagColumn).getValue();

    if (flagValue !== 'Processed') {  // Check if the flag is not set
      var firstName = sheet.getRange(lastRow, 1).getValue();
      var recipientEmail = sheet.getRange(lastRow, 2).getValue();

      if (recipientEmail) {
        Logger.log('New submission detected. Sending email...');
        sendEmailEmailNotification(firstName, recipientEmail);
        sheet.getRange(lastRow, flagColumn).setValue('Processed');  // Set flag to avoid reprocessing
      }
    }
  } catch (error) {
    Logger.log('Error in checkForNewSubmission: ' + error.message);
  }
}

function sendEmailNotification(firstName, recipientEmail) {
  try {
    Logger.log('Preparing to send email to: ' + recipientEmail);
    var subject = "Thank you for completing the assessment!";
    var body = `Hi ${firstName},\n\nThank you for completing our assessment. Your responses have been recorded successfully. If you have any questions, feel free to reach out.\n\nBest regards,\nThe Clean Divorce Team`;

    GmailApp.sendEmail(recipientEmail, subject, body);
    Logger.log('Email successfully sent to: ' + recipientEmail);
  } catch (error) {
    Logger.log('Error sending email: ' + error.message);
  }
}
function onEdit(e) {
  Browser.msgBox('testing');
}

报错截图

报错提示:Something went wrong Please reload the page to try again.


内容的提问来源于stack exchange,提问作者Rehman Leghari

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.14 05:22:19