fs-lawrisk/tools/inspect_excel_source.py

23 lines
837 B
Python
Raw Permalink Normal View History

import os
import pandas as pd
def exhaustive_search():
file_path = r"c:\Users\WIN10\Desktop\work\11th-week\法律风险提示-new\市监局-lawRisk-backend\市级初版-20251219\许可风险提示\101生产科 风险提示表(食品小作坊登记,市场监管部门) (1)_转自XLS.xlsx"
target_content = "在生产食品种类方面"
try:
xl = pd.ExcelFile(file_path)
for name in xl.sheet_names:
df = xl.parse(name, header=None)
for idx, row in df.iterrows():
row_str = " ".join(row.astype(str))
if target_content in row_str:
print(f"Sheet: {name} | Row {idx+1} | Cols: {list(row)[:5]}")
except Exception as e:
print(f"Error: {e}")
if __name__ == "__main__":
exhaustive_search()