Generate XX Bank invoice Excel and Word documents from templates. Use when the user needs to create invoice documents with customer information, loan details, and automatic name desensitization in filenames.
Generate Excel and Word invoice documents for XX Bank using predefined templates. The script automatically handles name desensitization for generated filenames.
bank_invoice/
├── SKILL.md # This file
├── scripts/
│ └── generate_bank.py # Python generation script
└── assets/
├── bank_template.xlsx # Excel template
└── bank_template.docx # Word template
All parameters are required:
| Parameter | Description | Example |
|---|---|---|
--name, -n | Customer name (will be desensitized in filename) | 张三丰 |
--id-card, -i | ID card number | 123456200001011234 |
--phone, -p | Contact phone | 13800138000 |
--email, -e | Email address | [email protected] |
--contract, -c | Contract number | HT20240410001 |
--loan, -l | Loan/Debit number | JD20240410001 |
--date, -d | Loan disbursement date (YYYY-MM-DD or YYYYMMDD) | 2024-04-10 |
--amount | Total loan amount | 100000 |
--bank-amount | Bank lending amount | 80000 |
--fee-type | Fee type description | 服务费 |
--invoice | Invoice amount | 5000 |
--serial, -s | Serial number for filename | 001 |
| Parameter | Description | Default |
|---|---|---|
--template-dir | Template files directory | Current directory |
--file-date | Date in filename (YYMMDD) | Today |
--output, -o | Output directory | Current directory |
From the skill directory, run:
python3 scripts/generate_bank.py \
--name "张三丰" \
--id-card "123456200001011234" \
--phone "13800138000" \
--email "[email protected]" \
--contract "HT20240410001" \
--loan "JD20240410001" \
--date "2024-04-10" \
--amount 100000 \
--bank-amount 80000 \
--fee-type "服务费" \
--invoice 5000 \
--serial "001"
Two files will be generated:
Excel: XX银行_张某某_YYMMDD_流水号.xlsx
Word: XX银行_张某某_YYMMDD_流水号.docx
| Original | Desensitized |
|---|---|
| 张三 | 张某 |
| 张三丰 | 张某某 |
| 张三丰四 | 张某某某 |
| 欧阳小明 | 欧某某某 |
The rule: Keep the first character (surname), replace all others with "某".
The script requires:
openpyxl - for Excel file handlingpython-docx - for Word file handlingInstall dependencies:
pip install openpyxl python-docx