50ce2c44c20fc9bdfcfcd16c44ef">a4345e5759 first commit лет назад: 4 3394 a4345e5759 first commit лет назад: 4 3394_fsm a4345e5759 first commit лет назад: 4 3394_vm a4345e5759 first commit лет назад: 4 3395 a4345e5759 first commit лет назад: 4 3429 a4345e5759 first commit лет назад: 4 3430 a4345e5759 first commit лет назад: 4 3431 a4345e5759 first commit лет назад: 4 3433 a4345e5759 first commit лет назад: 4 3439 a4345e5759 first commit лет назад: 4 3440 a4345e5759 first commit лет назад: 4 3455 a4345e5759 first commit лет назад: 4 3456 a4345e5759 first commit лет назад: 4 3456_fsm a4345e5759 first commit лет назад: 4 3456_vm a4345e5759 first commit лет назад: 4 3466 a4345e5759 first commit лет назад: 4 3467 a4345e5759 first commit лет назад: 4 3468 a4345e5759 first commit лет назад: 4 3501 a4345e5759 first commit лет назад: 4 3502 a4345e5759 first commit лет назад: 4 3503 a4345e5759 first commit лет назад: 4 3534 a4345e5759 first commit лет назад: 4 3541 a4345e5759 first commit лет назад: 4 3541_fsm a4345e5759 first commit лет назад: 4 3541_vm a4345e5759 first commit лет назад: 4 3542 a4345e5759 first commit лет назад: 4 3574 a4345e5759 first commit лет назад: 4 3575 a4345e5759 first commit лет назад: 4 3576 a4345e5759 first commit лет назад: 4 3596 a4345e5759 first commit лет назад: 4 3597 a4345e5759 first commit лет назад: 4 3598 a4345e5759 first commit лет назад: 4 3599 a4345e5759 first commit лет назад: 4 3600 a4345e5759 first commit лет назад: 4 3600_fsm a4345e5759 first commit лет назад: 4 3600_vm a4345e5759 first commit лет назад: 4 3601 a4345e5759 first commit лет назад: 4 3601_fsm a4345e5759 first commit лет назад: 4 3601_vm a4345e5759 first commit лет назад: 4 3602 a4345e5759 first commit лет назад: 4 3602_fsm a4345e5759 first commit лет назад: 4 3602_vm a4345e5759 first commit лет назад: 4 3603 a4345e5759 first commit лет назад: 4 3603_fsm a4345e5759 first commit лет назад: 4 3603_vm a4345e5759 first commit лет назад: 4 3604 a4345e5759 first commit лет назад: 4 3605 a4345e5759 first commit лет назад: 4 3606 a4345e5759 first commit лет назад: 4 3607 a4345e5759 first commit лет назад: 4 3608 a4345e5759 first commit лет назад: 4 3609 a4345e5759 first commit лет назад: 4 3712 a4345e5759 first commit лет назад: 4 3764 a4345e5759 first commit лет назад: 4 3764_fsm a4345e5759 first commit лет назад: 4 3764_vm a4345e5759 first commit лет назад: 4 3766 a4345e5759 first commit лет назад: 4 3767 a4345e5759 first commit лет назад: 4 3997 a4345e5759 first commit лет назад: 4 4143 a4345e5759 first commit лет назад: 4 4144 a4345e5759 first commit лет назад: 4 4145 a4345e5759 first commit лет назад: 4 4146 a4345e5759 first commit лет назад: 4 4147 a4345e5759 first commit лет назад: 4 4148 a4345e5759 first commit лет назад: 4 4149 a4345e5759 first commit лет назад: 4 4150 a4345e5759 first commit лет назад: 4 4151 a4345e5759 first commit лет назад: 4 4152 a4345e5759 first commit лет назад: 4 4153 a4345e5759 first commit лет назад: 4 4154 a4345e5759 first commit лет назад: 4 4155 a4345e5759 first commit лет назад: 4 4156 a4345e5759 first commit лет назад: 4 4157 a4345e5759 first commit лет назад: 4 4158 a4345e5759 first commit лет назад: 4 4159 a4345e5759 first commit лет назад: 4 4160 a4345e5759 first commit лет назад: 4 4161 a4345e5759 first commit лет назад: 4 4162 a4345e5759 first commit лет назад: 4 4163 a4345e5759 first commit лет назад: 4 4164 a4345e5759 first commit лет назад: 4 4165 a4345e5759 first commit лет назад: 4 4166 a4345e5759 first commit лет назад: 4 4167 a4345e5759 first commit лет назад: 4 4168 a4345e5759 first commit лет назад: 4 4169 a4345e5759 first commit лет назад: 4 4170 a4345e5759 first commit лет назад: 4 4171 a4345e5759 first commit лет назад: 4 4172 a4345e5759 first commit лет назад: 4 4173 a4345e5759 first commit лет назад: 4 4174 a4345e5759 first commit лет назад: 4 5002 a4345e5759 first commit лет назад: 4 548 a4345e5759 first commit лет назад: 4 549 a4345e5759 first commit лет назад: 4 6102 a4345e5759 first commit лет назад: 4 6104 a4345e5759 first commit лет назад: 4 6106 a4345e5759 first commit лет назад: 4 6110 a4345e5759 first commit лет назад: 4 6111 a4345e5759 first commit лет назад: 4 6112 a4345e5759 first commit лет назад: 4 6113 a4345e5759 first commit лет назад: 4 6117 a4345e5759 first commit лет назад: 4 826 a4345e5759 first commit лет назад: 4 827 a4345e5759 first commit лет назад: 4 828 a4345e5759 first commit лет назад: 4 PG_VERSION a4345e5759 first commit лет назад: 4 pg_filenode.map a4345e5759 first commit лет назад: 4 tum/coi - Gogs: Simplico Git Service

Sin descripción

test_xls.py 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. from openpyxl import load_workbook
  2. from datetime import datetime
  3. # Define the data
  4. data = {
  5. "customer": "xxxx",
  6. "inspect_date": "2025-01-15",
  7. "lot_no": "12345",
  8. "size": "Large",
  9. "pcs": "10 pcs",
  10. "spec": "Spec-A",
  11. "d1_act": "10",
  12. "d2_act": "0", # Adjust this to test hiding `No.2` table
  13. }
  14. # Load the Excel template
  15. template_path = "./hardness.xlsx" # Replace with your template file path
  16. workbook = load_workbook(template_path)
  17. sheet = workbook.active
  18. # Replace placeholders with actual values
  19. for row in sheet.iter_rows():
  20. for cell in row:
  21. if cell.value and isinstance(cell.value, str) and cell.value.startswith("<") and cell.value.endswith(">"):
  22. placeholder = cell.value.strip("<>")
  23. if placeholder in data:
  24. cell.value = data[placeholder]
  25. # Hide `No.2` table if `d2_act` is 0
  26. if data.get("d2_act") == "0":
  27. # Adjust the range to the actual No.2 table location in your template
  28. table_start_row = 20 # Replace with the actual start row of the No.2 table
  29. table_end_row = 25 # Replace with the actual end row of the No.2 table
  30. table_start_col = 1 # Starting column for the table
  31. table_end_col = 5 # Ending column for the table
  32. # Clear only non-merged cells
  33. sheet.row_dimensions.group(24, 28, hidden=True)
  34. # Save the updated file with a timestamp
  35. timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
  36. output_path = f"hardness_filled_{timestamp}.xlsx"
  37. workbook.save(output_path)
  38. print(f"File saved as {output_path}")