工時記錄統計工具Work Record Statistics Tool
以 Python + Tkinter 製作的桌面工具:讀取 Excel 工時記錄的多個 Sheet,依日期區間篩選、依 Sheet 加權畫出堆疊長條圖,並匯出含圖表與詳細記錄的格式化 Excel 報告。A Python + Tkinter desktop tool: it reads work-log records from multiple Excel sheets, filters them by date range, draws a weighted stacked bar chart per sheet, and exports a formatted Excel report with the chart and detailed records.
原始碼未公開Source is private
如何運作How it works
讀取有效 Sheet
瀏覽選擇 .xlsx 後按「讀取」,逐一檢查各 Sheet 的表頭是否能對上 更新進度、狀態、作業名稱、目前進度、附註描述(含關鍵字別名),符合者才列為有效 Sheet。日期區間篩選
預設為今天往前 15 天到今天,日期欄支援 Excel 日期、YYYY-MM-DD 與 YYYY/MM/DD,只保留區間內的記錄。內容智慧分組
作業名稱、目前進度、附註描述依換行、|、;、、拆開並去重,依內容中的 4 位數日期(如 0205)由新到舊排序,非進度項目加上「附註:」前綴。加權與堆疊長條圖
每個 Sheet 輸入整數加權值(程式自動除以 10),以 matplotlib 畫出依日期由新到舊的堆疊長條圖並標示總數;加權值依檔名存入 sheet_weight_config.json,下次自動帶入。匯出格式化 Excel
勾選要匯出的 Sheet 後按「匯出Excel」,用 openpyxl 寫入日期區間標題、嵌入統計圖與詳細工作記錄,表頭藍底白字、自動換行、固定欄寬,輸出為 <結束日期>_工作報告.xlsx。
架構Architecture
flowchart LR
X[(Excel 工時記錄 .xlsx)] --> R[read_excel_full_data 表頭比對與日期篩選]
R --> S[merge_and_smart_sort 拆分 去重 排序]
S --> D[(raw_data 記憶體)]
U[Tkinter 介面] --> R
U <--> W[(sheet_weight_config.json)]
D --> C[update_chart matplotlib 堆疊長條圖]
C --> U
D --> E[export_excel openpyxl]
C --> E
E --> O[(結束日期_工作報告.xlsx)]技術Tech stack
PythonTkinteropenpyxlmatplotlibPyInstallerWindows .exe