2025年9月13日 星期六

只要點兩下就能利用彰化縣EIP系統學生帳號CSV產出指定學生名單的Google Classroom帳號總表

系列文章:
1.只要點兩下就能產出彰化縣Cloud School 學生帳號密碼匯入彰化縣EIP系統學生帳號密碼的CSV
1.https://skjhcreator.blogspot.com/2025/08/cloud-school-eipcsv.html
2.只要點兩下就能利用彰化縣EIP系統學生帳號CSV產出建立Google Classroom 學生總表
2.https://skjhcreator.blogspot.com/2025/08/eipcsvgoogle-classroom.html 
3.
只要點兩下就能利用彰化縣EIP系統學生帳號CSV產出指定學生名單的Google Classroom學生帳號總表
3.https://skjhcreator.blogspot.com/2025/09/eipcsvgoogle-classroom.html

        彰化縣數位學習師生單一帳號系統(EIP=Enterprise Information Portal)於2025年7月7日正式啟用。學務處想利用Google Classroom 來建立全校視訊廣播。因此,給資訊組全年級各班班長的年班座號總表。而資訊組要能產出一個全年級各班班長的Classroom 帳號總表,方便學務處將各班班長加入Google Classroom。 而資訊組只要將這件事簡化,只要點兩下就能得到指定學生名單的Google Classroom帳號總表。然後教學務處如何使用這個程式即可。
        由於EIP系統學生帳號只有帳號,沒有後面的@chc.edu.tw。還要想辦法將@chc.edu.tw加入。但問題是用Excel開啟CSV,學生帳號只有數字,在Excel 格式就會跑掉。比方說學生帳號0432579,在Excel,就會變成432579。若用記事本開,學生帳號"0432579",完全沒法用尋找、取代等方式來簡單完成。就要複製@chc.edu.tw,然後一個個貼上。

1.EIP學生帳號下載方式:
下載的學生資料檔名為學校代碼_學生資料_日期時間.CSV,其格式如下:


下載檔案解壓密碼:demo1234
Here is the website where you can download the program and find instructions:
Download。Extraction Password: demo1234
使用教學(Instructional videos):



以下是開發過程與原始碼 (Development process and code):
程式名稱(Program name):pyStudent2ClassRoomStudentAccount.py
程式內容(Code):
import csv
import os

# 取得目前的工作目錄
current_directory = os.getcwd()
# 取得目前的工作目錄內input
current_directory_input = current_directory+"\\input\\"
# 取得工作目錄input內所有檔案名稱
current_directory_input_files = os.listdir(current_directory_input)
# 以副檔名來判斷設定相對應的檔案
for i in current_directory_input_files:
    TempFileName,TempFileExtension = os.path.splitext(i)
    if TempFileExtension == ".csv":
        TempCSVFile = i
    elif TempFileExtension == ".xlsx":
        TempXLSXFile = i
    else:
        TempTXT = i
             
# 設定CSVList為一個 list
CSVList = []
# 開啟 CSV 檔案
with open(current_directory_input+TempCSVFile, mode='r', encoding='utf-8') as file:
    # 建立 CSV 讀取器
    reader = csv.reader(file)
    # 逐行讀取 CSV 檔案內容
    for row in reader:
        CSVList.append(row)

# CSVListTitle 取得 CSVList[0]
CSVListTitle = CSVList[0]
# 刪除CSVList[0]
CSVList.pop(0)
# 對CSVList 進行排序
CSVList.sort(key=lambda x: x[0])

ResultList = []
ResultList.append(CSVListTitle)

StudentList = []
with open(current_directory_input+TempTXT, "r") as Stufile:
    tempStudentList = Stufile.readlines()

for i in tempStudentList:
    temp = i.strip("\n")
    StudentList.append(temp)

TempStudentSet = set(StudentList)    
   
TempResultSet = set()
for i in StudentList:
    for j in CSVList:
        if str(i) == str(j[0]):
            #print(str(i),str(j[0]))
            ResultList.append([str(j[0]),str(j[1])+"@chc.edu.tw"])
            TempResultSet.add(str(i))
           
ExceptionSet = TempStudentSet - TempResultSet
ExceptionList = list(ExceptionSet)
           
with open(current_directory+"\\Student2ClassRoomStudentAccount.csv","w", newline="", encoding="utf-8") as file:
    writer = csv.writer(file)
    writer.writerows(ResultList)
print("Student2ClassRoomStudentAccount.csv 檔案已成功寫入!")    

with open(current_directory+"\\Student2ClassRoomStudentAccountException.txt", "w",encoding="utf-8") as file:
    file.write("Excel 找不到的學生帳號如下:\n")
    for i in ExceptionList:
        file.write(str(i)+"\n")
print("Student2ClassRoomStudentAccountException.csv 檔案已成功寫入!")



只要點兩下就能利用彰化縣EIP系統學生帳號CSV產出指定學生名單的Google Classroom帳號總表

系列文章: 1. 只要點兩下就能產出彰化縣Cloud School 學生帳號密碼匯入彰化縣EIP系統學生帳號密碼的CSV 1. https://skjhcreator.blogspot.com/2025/08/cloud-school-eipcsv.html 2. 只要點兩下就能...