From ff2af84c4d159b44419ca2b62522ea1f83324b4a Mon Sep 17 00:00:00 2001 From: diaco Date: Sat, 14 Sep 2024 11:21:47 +0330 Subject: [PATCH] WIP --- src/xlsx_clean/clean_cells.py | 10 ++++++++++ src/xlsx_clean/file_data.csv | 7 ++++--- src/xlsx_clean/strings.txt | 4 +++- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/xlsx_clean/clean_cells.py b/src/xlsx_clean/clean_cells.py index 50b900e..e6721b4 100644 --- a/src/xlsx_clean/clean_cells.py +++ b/src/xlsx_clean/clean_cells.py @@ -80,9 +80,19 @@ console.print(f"Selected: {pathlib.Path(ref_workbook_name).stem}") # workbook = load_workbook(ref_workbook_name) temp_workbook = str(pathlib.Path.cwd() / "temp_workbook.xlsx") shutil.copyfile(ref_workbook_name, temp_workbook) + +# in case of this error +# AttributeError: module 'win32com.gen_py.00020813-0000-0000-C000-000000000046x0x1x9' has no attribute 'CLSIDToClassMap' +# see https://stackoverflow.com/questions/52889704 excel = win32.gencache.EnsureDispatch("Excel.Application") excel.Visible = True + +# Need to load the addins before opening the workbook workbook = excel.Workbooks.Open(temp_workbook) +addin_path_1 = content[3] +excel.Workbooks.Open(addin_path_1) +addin_path_2 = content[4] +excel.Workbooks.Open(addin_path_2) cells_to_clear = path_df[ (path_df["set_name"] == selected_set) & (path_df["dir"].str.endswith(selected_dir)) ]["cells_to_clear"].iloc[0] diff --git a/src/xlsx_clean/file_data.csv b/src/xlsx_clean/file_data.csv index 7b67512..f7a491c 100644 --- a/src/xlsx_clean/file_data.csv +++ b/src/xlsx_clean/file_data.csv @@ -1,12 +1,13 @@ dir,pattern,set_name,cells_to_clear,serial_cell -"D:\Kimia Razi\Production\QC Datasheet\1403\KRCY1100T Blue","KRCY1100T Blue [SERIAL].xlsx","Kimia Razi","Batch!C14,Batch!C18:C19,Batch!B20,Batch!C3,Batch!G11,Batch!G14,Batch!G18,Batch!I11,Batch!I14,Batch!I18,Batch!K11:M11,Batch!K14:M14,Batch!K18:M18,Batch!B20,Milling!F8:J8,Milling!F11:J12,Milling!F15:J15,Milling!C15,Milling!C12,Milling!C11,'KW & Temp'!A8:G8,'KW & Temp'!I8","Batch!C2" +"D:\Kimia Razi\Production\QC Datasheet\1403\KRCY1100T Blue","KRCY1100T Blue [SERIAL].xlsx","Kimia Razi","Batch!F2:F3,Batch!I2:I3,Batch!H12:L12,Batch!O9:Q10,Batch!O12:Q12,Batch!N10,Batch!N13,Batch!D24,'KW & Temp'!C4:H4,'KW & Temp'!J4,Milling!G5:K8,Milling!G11:K11,Milling!D7:D8,Milling!D11","Batch!D3" "D:\Kimia Razi\Production\QC Datasheet\1403\KRBK1300T Black","KRBK1300T Black [SERIAL].xlsx","Kimia Razi","Batch!C14,Batch!C18:C19,Batch!B20,Batch!C3,Batch!G11,Batch!G14,Batch!G18,Batch!I11,Batch!I14,Batch!I18,Batch!K11:M11,Batch!K14:M14,Batch!K18:M18,Batch!B20,Milling!F8:J8,Milling!F11:J12,Milling!F15:J15,Milling!C15,Milling!C12,Milling!C11,'KW & Temp'!A8:G8,'KW & Temp'!I8","Batch!C2" "D:\Kimia Razi\Production\QC Datasheet\1403\KRBR1200T Brown","KRBR1200T Brown [SERIAL].xlsx","Kimia Razi","Batch!C14,Batch!C18:C19,Batch!B20,Batch!C3,Batch!G11,Batch!G14,Batch!G18,Batch!I11,Batch!I14,Batch!I18,Batch!K11:M11,Batch!K14:M14,Batch!K18:M18,Batch!B20,Milling!F8:J8,Milling!F11:J12,Milling!F15:J15,Milling!C15,Milling!C12,Milling!C11,'KW & Temp'!A8:G8,'KW & Temp'!I8","Batch!C2" "D:\Kimia Razi\Production\QC Datasheet\1403\KRYL1400T Yellow","KRYL1400T Yellow [SERIAL].xlsx","Kimia Razi","Batch!G14,Batch!G11,Batch!I11,Batch!I14,Batch!I20,Batch!G20,Batch!K11:M11,Batch!K14:M14,Batch!K20:M20,Batch!C14,Batch!C20:C21,Batch!C3,Batch!B22,'KW & Temp'!A8:G8,'KW & Temp'!I8,Milling!F8:J8,Milling!F10:J11,Milling!F14:J14,Milling!C14,Milling!C11","Batch!C2" "D:\Kimia Razi\Production\QC Datasheet\1403\KRBG1600T Beige","KRBG1600T Beige [SERIAL].xlsx","Kimia Razi","Batch!G12,Batch!G15,Batch!G21,Batch!I12,Batch!I15,Batch!I21,Batch!K12:M12,Batch!K15:M15,Batch!K21:M21,Batch!B23,Batch!C21:C22,Batch!C15,Batch!C3,Batch!B23,'KW & Temp'!A8:G8,'KW & Temp'!I8,Milling!F8:J8,Milling!F10:J11,Milling!F14:J14,Milling!C14,Milling!C11","Batch!C2" "D:\Kimia Razi\Production\QC Datasheet\1403\KRPK1500T Pink","KRPK1500T Pink [SERIAL].xlsx","Kimia Razi","Batch!G14,Batch!G11,Batch!I11,Batch!I14,Batch!I20,Batch!G20,Batch!K11:M11,Batch!K14:M14,Batch!K20:M20,Batch!C14,Batch!C20:C21,Batch!C3,Batch!B22,'KW & Temp'!A8:G8,'KW & Temp'!I8,Milling!F8:J8,Milling!F10:J11,Milling!F14:J14,Milling!C14,Milling!C11","Batch!C2" +"D:\Kimia Razi\Production\QC Datasheet\1403\KRHN1700T Honey","KRHN1700T Honey [SERIAL].xlsx","Kimia Razi","Batch!F2:F3,Batch!I2:I3,Batch!H12:L12,Batch!O9:Q10,Batch!O12:Q12,Batch!N10,Batch!N13,Batch!D24,'KW & Temp'!C4:H4,'KW & Temp'!J4,Milling!G5:K8,Milling!G11:K11,Milling!D7:D8,Milling!D11","Batch!D3" "D:\inco\Quality control data sheet\2024\ICJEH680 Black","ICJ_EH680 op. [SERIAL].xlsx","inco","Batch!C15:C16,Batch!C18,Batch!C20:C21,Batch!C3,Batch!C12,Batch!H9,Batch!H12,Batch!H20,Batch!J9:K9,Batch!J12:K12,Batch!J20:K20,Batch!B22,Batch!M7:N22,'KW & Temp'!A8:G8,'KW & Temp'!I8,Milling!D8,Milling!C9:C11,Milling!C15,Milling!F8:J11,Milling!F15:J15","Batch!C2" "D:\inco\Quality control data sheet\2024\ICJ108 Beige","ICJ_108 op. [SERIAL].xlsx","inco","Batch!C15:C18,Batch!C20:C21,Batch!C3,Batch!C12,Batch!H9,Batch!H12,Batch!H20,Batch!J9:K9,Batch!J12:K12,Batch!J20:K20,Batch!B22,Batch!M7:N22,Milling!D8,'KW & Temp'!A8:G8,'KW & Temp'!I8,Milling!C9:C11,Milling!C15,Milling!F8:J11,Milling!F15:J15","Batch!C2" -"D:\inco\Quality control data sheet\2024\ICJ610 Black","ICJ_610 op. [SERIAL].xlsx","inco","Batch!C15:C18,Batch!C20:C21,Batch!C3,Batch!C12,Batch!H9,Batch!H12,Batch!H20,Batch!J9:K9,Batch!J12:K12,Batch!J20:K20,Batch!B22,Batch!M7:N22,Milling!D8,'KW & Temp'!A8:G8,'KW & Temp'!I8,Milling!C9:C11,Milling!C15,Milling!F8:J11,Milling!F15:J15","Batch!C2" -"D:\inco\Quality control data sheet\2024\ICJ407 Brown","ICJ_407 op. [SERIAL].xlsx","inco","Batch!C15:C18,Batch!C20:C21,Batch!C3,Batch!C12,Batch!H9,Batch!H12,Batch!H20,Batch!J9:K9,Batch!J12:K12,Batch!J20:K20,Batch!B22,Batch!M7:N22,Milling!D8,'KW & Temp'!A8:G8,'KW & Temp'!I8,Milling!C9:C11,Milling!C15,Milling!F8:J11,Milling!F15:J15","Batch!C2" +"D:\inco\Quality control data sheet\2024\ICJ610 Black","ICJ_610 op. [SERIAL].xlsx","inco","Batch!F2:F3,Batch!I2:I3,Batch!E12:L12,Batch!O9:Q10,Batch!O12:Q12,Batch!N10,Batch!N13,Batch!D24,'KW & Temp'!C4:H4,'KW & Temp'!J4,Milling!G5:K8,Milling!G11:K11,Milling!D6:D8,Milling!D11","Batch!D3" +"D:\inco\Quality control data sheet\2024\ICJ407 Brown","ICJ_407 op. [SERIAL].xlsx","inco","Batch!F2:F3,Batch!I2:I3,Batch!E12:L12,Batch!O9:Q10,Batch!O12:Q12,Batch!N10,Batch!N13,Batch!D24,'KW & Temp'!C4:H4,'KW & Temp'!J4,Milling!G5:K8,Milling!G11:K11,Milling!D6:D8,Milling!D11","Batch!D3" "D:\inco\Quality control data sheet\2024\ICJ703 Pink","ICJ_703 op. [SERIAL].xlsx","inco","Batch!C15:C18,Batch!C20:C21,Batch!C3,Batch!C12,Batch!H9,Batch!H12,Batch!H20,Batch!J9:K9,Batch!J12:K12,Batch!J20:K20,Batch!B22,Batch!M7:N22,Milling!D8,'KW & Temp'!A8:G8,'KW & Temp'!I8,Milling!C9:C11,Milling!C15,Milling!F8:J11,Milling!F15:J15","Batch!C2" \ No newline at end of file diff --git a/src/xlsx_clean/strings.txt b/src/xlsx_clean/strings.txt index f22db5a..3b31182 100644 --- a/src/xlsx_clean/strings.txt +++ b/src/xlsx_clean/strings.txt @@ -1,3 +1,5 @@ Select Set Select Ink Color -Serial: \ No newline at end of file +Serial: +C:\Users\johar\AppData\Roaming\Microsoft\AddIns\Diaco.KimiaRazi.Inkunit.xlam +C:\Users\johar\AppData\Roaming\Microsoft\AddIns\Persian Function For EXCEL_V2_1(www.rasekhoon.net).xla \ No newline at end of file