
成果範例
Merging the monthly sales files of 9 shops into one Excel report
How it is run
python merge_sales.py --month 2026-10
2026-11-02 09:14:03 INFO Folder: sales/2026-10, 9 files found
2026-11-02 09:14:03 INFO shop-01.csv: 1,284 rows
2026-11-02 09:14:04 INFO shop-02.xlsx: 967 rows
2026-11-02 09:14:04 WARN shop-07.csv: 3 rows without a price skipped (lines 88, 412, 913)
2026-11-02 09:14:05 INFO Done: 10,412 rows -> report-2026-10.xlsx (sheets "Sales" and "Totals")
Settings, not code
The column names of each shop live in settings.ini, so a new shop or a renamed column is a line there:
[columns]
date = Date, Sale date, Day
product = Product, Item, Name
quantity = Qty, Quantity, Pcs
price = Price, Unit price
A part of the code
def read_shop_file(path: Path, columns: dict[str, list[str]]) -> pd.DataFrame:
"""Reads one shop's file and gives it the report's column names."""
table = pd.read_excel(path) if path.suffix == ".xlsx" else pd.read_csv(path, encoding="utf-8-sig")
renamed = {}
for name, variants in columns.items():
found = next((c for c in table.columns if c.strip() in variants), None)
if found is None:
raise ReportError(f"{path.name}: no column for '{name}' (looked for {', '.join(variants)})")
renamed[found] = name
table = table.rename(columns=renamed)[list(columns)]
table["shop"] = path.stem
return table
Files: a ZIP archive with merge_sales.py (310 lines), settings.ini, requirements.txt and a README with installing Python, running the script and what each message in the log means. The client runs it on their own computer.
Client: a small chain of 9 stationery shops; each shop sends its sales for the month as a CSV or Excel file, with slightly different column names. Task: one script that reads every file in a folder, brings the columns to one shape, and writes a single Excel report with all sales and a sheet of totals by shop.
客戶與所有細節皆為虛構。
關於此服務
如果您用 Google 試算表記錄訂單或工時,手動開每張發票就得把客戶、品項和總計複製到文件裡,再存成 PDF。這個 Google Apps Script 會在您的試算表中加入一個按鈕:它用該列資料填入您自己在 Google 文件或試算表中的發票範本,依您想要的檔名把 PDF 存到雲端硬碟資料夾,並把連結填回該列。標準版起,它能處理多個品項列和發票編號;進階版還能從您的 Gmail 把每份 PDF 寄給客戶。總計、稅額和文字都來自您的試算表和範本:腳本只依您說明的方式計算,不提供稅務或會計建議,所以請檢查最初幾張發票。腳本由您在自己的 Google 帳戶中安裝和執行。
包含內容
- 您會得到一個 ZIP 壓縮檔,內含 Apps Script 程式碼和 README,說明如何加到您的試算表和範本中;訂單頁面上也會顯示程式碼。
- 您自己的範本您在 Google 文件或試算表中的版面、Logo 和文字
- PDF 存到雲端硬碟依編號、客戶和日期命名,存到您設定的資料夾
- 連結填回該列一眼就能看出哪些列已經開過發票
- 發票編號標準版起,從您的試算表取得下一個編號
- 易讀的程式碼附有註解,日後很容易修改欄位
服務流程
- 1範本您提供試算表的欄位和發票範本
- 2程式碼我們撰寫腳本和安裝說明
- 3試跑您在試算表的副本中開幾張測試發票,並檢查金額
- 4修改您在方案範圍內提出修改,並附上任何錯誤訊息
需要您提供的資料
您試算表的欄位名稱和兩三列虛構資料、您的發票範本(Google 文件或試算表,或您目前寄出的發票 PDF),並標出每個值要放的位置,以及總計的計算方式:稅率、折扣、幣別和四捨五入方式,請依您會計師的指示提供。發票如何編號和命名、存放 PDF 的雲端硬碟資料夾;進階版請另附寄給客戶的郵件內文。
我們會詢問您:
- 您為什麼開發票?
- 試算表有哪些欄位?
- 您的發票長什麼樣子?
- 總計怎麼算?
比較方案
付款保障
下單時付款,但只有在驗收成果後,款項才會撥付。
- 固定價格付款後,方案價格不會變動。
- 款項先行保留付款時,金額只會先保留,在您驗收後才會撥付給服務。
- 交付前檢查每份成果在交到您手上之前都會經過品質檢查,您也可以在驗收前於訂單頁面查看成果。
- 免費修改在需求說明範圍內,可依方案允許的次數提出修改。
- 3 天後自動驗收若您在交付後 3 天內未驗收也未提出修改,成果將自動驗收。若您在交付後於訂單聊天室留言,訂單會暫停自動驗收;我們回覆後,可能會重新起算 3 天,並會在聊天室中告知。
- 重新製作或全額退款若成果不符合您的需求說明且修改後仍未改善,或製作時間超過交付期限的兩倍,請在訂單聊天室留言:我們將重新製作,或全額退還款項。
常見問題
發票在法律上會正確嗎?
腳本會填入您範本和試算表中的內容,並依您說明的方式計算。在您所在的國家,發票必須包含哪些內容,由您或您的會計師判斷;我們不提供稅務或法律建議。
可以用郵件寄出發票嗎?
進階版可以:在 Google 為您帳戶設定的每日寄送上限內,從您自己的 Gmail 寄到該列中的地址。您也可以關閉寄送功能,只存 PDF。
可以收款或串接我的會計軟體嗎?
不行,它只負責產出 PDF。您已有的付款連結,可以從試算表以文字形式印在發票上。
你們會取得我雲端硬碟的存取權嗎?
不會。程式碼由您加到自己的試算表中,並由您自己授權存取。我們絕不登入您的 Google 帳戶。
沒有找到您要的答案?