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

姐妹会花名册Google Script移除成员功能失效,求助排查

Hey there! Let's tackle this Google Apps Script issue for your sorority roster. It sounds like you need a script that moves or copies members from the "Actives" sheet to the right target sheet based on their status—with specific behavior for graduation/transfer (just copy the name) vs. other statuses (move the whole entry).

Fixing Your Sorority Roster Google Script

First, let's build a complete, working version of the script that aligns with your needs, since your original code was cut off.

Key Requirements Recap

  • When a member's status is entered in the "Actives" sheet:
    • If status is Graduated or Transferred, only copy their name to the corresponding sheet
    • For other statuses (e.g., Resigned, Inactive), move the entire row from "Actives" to the matching target sheet

Complete Working Script

function onEdit(e) {
  // Get the active sheet and edited cell details
  const activeSheet = e.source.getActiveSheet();
  const editedRange = e.range;
  
  // Only run if the edit is in the "Actives" sheet and the status column (adjust column number below—here it's column D, index 4)
  if (activeSheet.getName() !== "Actives" || editedRange.getColumn() !== 4) return;
  
  const status = editedRange.getValue().trim();
  const row = editedRange.getRow();
  const memberName = activeSheet.getRange(row, 1).getValue(); // Assuming name is in column A
  
  // Map statuses to their target sheet names—update this to match your actual sheet names!
  const statusSheetMap = {
    "Graduated": "Graduates",
    "Transferred": "Transfers",
    "Resigned": "Resigned Members",
    "Inactive": "Inactive Members"
  };
  
  // Exit if the status isn't recognized in our mapping
  if (!statusSheetMap[status]) {
    SpreadsheetApp.getUi().alert(`Status "${status}" isn't set up in the script. Please update the statusSheetMap!`);
    return;
  }
  
  const targetSheet = e.source.getSheetByName(statusSheetMap[status]);
  
  // Handle copy/move logic based on status type
  if (status === "Graduated" || status === "Transferred") {
    // Copy only the name to the next empty row in the target sheet
    const nextEmptyRow = targetSheet.getLastRow() + 1;
    targetSheet.getRange(nextEmptyRow, 1).setValue(memberName);
  } else {
    // Move the entire row to the target sheet, then delete it from Actives
    const rowData = activeSheet.getRange(row, 1, 1, activeSheet.getLastColumn()).getValues()[0];
    targetSheet.appendRow(rowData);
    activeSheet.deleteRow(row);
  }
}

Critical Setup Steps

  • Adjust Columns: The script assumes status is in column D (index 4) and names are in column A. Change these numbers if your sheet uses different columns.
  • Update Sheet Mappings: Modify the statusSheetMap object to match your actual sheet names (e.g., if your graduates sheet is named "Alumni", replace "Graduates" with "Alumni").
  • Test Safely: Make a copy of your roster spreadsheet before testing the script to avoid accidental data loss.
  • Grant Permissions: The first time you run the script manually (via the Apps Script editor's play button), you'll need to authorize it to edit your spreadsheet.

Troubleshooting Tips

  • Script Not Triggering: Double-check the function name is exactly onEdit (case-sensitive!) and you're editing the correct column in the "Actives" sheet.
  • Data Not Copying/Moving: Ensure target sheet names in statusSheetMap match exactly (capitalization and spacing matter!).
  • Permission Errors: Run the script once from the editor to complete the authorization flow—this is required for edit triggers to work.

内容的提问来源于stack exchange,提问作者Elizabeth Furtado

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.25 08:32:42