| | |
| | | from openpyxl import load_workbook |
| | | from openpyxl.utils import get_column_letter |
| | | from datetime import datetime |
| | | import os |
| | | |
| | | |
| | | def run_conformity(): |
| | | try: |
| | | # 加载模板文件 |
| | | template_path = os.path.join('app', 'utils', 'excelmerge', '国网上海电力整合模版.xlsx') |
| | | template_excel = load_workbook(template_path) |
| | |
| | | a_cell_value = ssheet.cell(row=row, column=1).value |
| | | if isinstance(a_cell_value, (int, float)) and any( |
| | | ssheet.cell(row=row, column=col).value for col in range(2, ssheet.max_column + 1)): |
| | | tsheet.append([ssheet.cell(row=row, column=col).value for col in range(1, ssheet.max_column + 1)]) |
| | | tsheet.append( |
| | | [ssheet.cell(row=row, column=col).value for col in range(1, ssheet.max_column + 1)]) |
| | | |
| | | source_excel.close() |
| | | |
| | |
| | | template_excel.save(output_path) |
| | | template_excel.close() |
| | | |
| | | return timestamp |
| | | return True |
| | | except Exception as e: |
| | | print(f"读取数据发生错误: {e}") |
| | | return False |