hariqueen commited on
Commit
e39b4a7
Β·
verified Β·
1 Parent(s): 1d4cb62

update xls

Browse files
Files changed (1) hide show
  1. main.py +12 -3
main.py CHANGED
@@ -77,13 +77,22 @@ def process_rental_company_with_voucher(uploaded_file_path, voucher_number):
77
  result_df = file_handler.prepare_file_with_template(erp_df, erp_form)
78
 
79
  # μ €μž₯
80
- output_filename = f"μžλ™μ „ν‘œ_μ™„μ„±νŒŒμΌ_{datetime.now().strftime('%Y%m%d')}.xlsx"
81
  output_path = os.path.join(cfg.OUTPUT_DIR, output_filename)
82
 
83
  os.makedirs(cfg.OUTPUT_DIR, exist_ok=True)
84
 
85
- # 이제 μ€€λΉ„λœ result_dfλ₯Ό μ €μž₯
86
- result_df.to_excel(output_path, index=False, engine='openpyxl')
 
 
 
 
 
 
 
 
 
87
 
88
  return output_path
89
 
 
77
  result_df = file_handler.prepare_file_with_template(erp_df, erp_form)
78
 
79
  # μ €μž₯
80
+ output_filename = f"μžλ™μ „ν‘œ_μ™„μ„±νŒŒμΌ_{datetime.now().strftime('%Y%m%d')}.xls"
81
  output_path = os.path.join(cfg.OUTPUT_DIR, output_filename)
82
 
83
  os.makedirs(cfg.OUTPUT_DIR, exist_ok=True)
84
 
85
+ # 이제 μ€€λΉ„λœ result_dfλ₯Ό Excel 97-2003 ν˜•μ‹(.xls)으둜 μ €μž₯
86
+ try:
87
+ result_df.to_excel(output_path, index=False, engine='xlwt')
88
+ print(f"Excel 97-2003 ν˜•μ‹(.xls)으둜 파일 μ €μž₯ μ™„λ£Œ: {output_path}")
89
+ except Exception as e:
90
+ print(f"μ—‘μ…€ 파일 μ €μž₯ 쀑 였λ₯˜ λ°œμƒ: {e}")
91
+ # 였λ₯˜ λ°œμƒ μ‹œ λ°±μ—…μœΌλ‘œ xlsx ν˜•μ‹ μ €μž₯ μ‹œλ„
92
+ backup_path = output_path.replace('.xls', '.xlsx')
93
+ result_df.to_excel(backup_path, index=False, engine='openpyxl')
94
+ print(f"λŒ€μ²΄ ν˜•μ‹(.xlsx)으둜 파일 μ €μž₯ μ™„λ£Œ: {backup_path}")
95
+ output_path = backup_path
96
 
97
  return output_path
98