Spaces:
Sleeping
Sleeping
update xls
Browse files
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')}.
|
| 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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
|