[Python] Python flask API

Discussão em 'Python' iniciado por Stack, Março 6, 2025.

  1. Stack

    Stack Membro Participativo

    Why my code is not sending the data to Excel

    def save_attendance(section, student_name, status, additional_info=""):
    try:
    print(f"[DEBUG] Saving attendance: {section}, {student_name}, {status}, {additional_info}")
    sheet = client.open_by_key(ATTENDANCE_SHEETS[section]).get_worksheet(0)
    score = attendance_mapping.get(status, 0)
    timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")

    sheet.append_row([timestamp, student_name, status, score, additional_info])
    print("[DEBUG] Successfully added to Google Sheets!")
    return True
    except Exception as e:
    print(f"[ERROR] Saving attendance: {e}")
    return False

    Continue reading...

Compartilhe esta Página