Updates
This commit is contained in:
Binary file not shown.
BIN
OCTO/octo_1.xlsx
BIN
OCTO/octo_1.xlsx
Binary file not shown.
BIN
OCTO/octo_2.xlsx
BIN
OCTO/octo_2.xlsx
Binary file not shown.
BIN
OCTO/octo_3.xlsx
BIN
OCTO/octo_3.xlsx
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -161,6 +161,23 @@ def write_chunks(parts: list[tuple[str, str]], output_dir: Path) -> None:
|
|||||||
log.info(f"Done – {total} unique parts across {n_files} file(s) in {output_dir}/")
|
log.info(f"Done – {total} unique parts across {n_files} file(s) in {output_dir}/")
|
||||||
|
|
||||||
|
|
||||||
|
def write_siliconexpert(parts: list[tuple[str, str]], output_dir: Path) -> None:
|
||||||
|
output_dir.mkdir(exist_ok=True)
|
||||||
|
|
||||||
|
df = pd.DataFrame(parts, columns=["Manufacturer", "MPN"])
|
||||||
|
df.sort_values(["Manufacturer", "MPN"], inplace=True, ignore_index=True)
|
||||||
|
out = output_dir / "siliconexpert.xlsx"
|
||||||
|
|
||||||
|
with pd.ExcelWriter(out, engine="openpyxl") as writer:
|
||||||
|
df.to_excel(writer, index=False, sheet_name="Parts")
|
||||||
|
ws = writer.sheets["Parts"]
|
||||||
|
for col in ws.columns:
|
||||||
|
width = max(len(str(cell.value or "")) for cell in col)
|
||||||
|
ws.column_dimensions[col[0].column_letter].width = min(width + 3, 60)
|
||||||
|
|
||||||
|
log.info(f" Written → {out} ({len(df)} parts)")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
if not BOM_DIR.exists():
|
if not BOM_DIR.exists():
|
||||||
log.error(f"BoM directory '{BOM_DIR}' not found.")
|
log.error(f"BoM directory '{BOM_DIR}' not found.")
|
||||||
@@ -168,3 +185,4 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
parts = extract(BOM_DIR)
|
parts = extract(BOM_DIR)
|
||||||
write_chunks(parts, OUTPUT_DIR)
|
write_chunks(parts, OUTPUT_DIR)
|
||||||
|
write_siliconexpert(parts, OUTPUT_DIR)
|
||||||
|
|||||||
Reference in New Issue
Block a user