Files
proclean-claw/read_excel_tool.py
2026-04-09 22:22:54 +08:00

25 lines
679 B
Python

import pandas as pd
import sys
def read_excel(file_path):
try:
# Try reading the Excel file
# Note: pandas requires openpyxl for .xlsx files
df = pd.read_excel(file_path)
# Display basic info
print(f"--- File Info ---")
print(f"Columns: {df.columns.tolist()}")
print(f"Total Rows: {len(df)}")
print(f"\n--- First 10 Rows ---")
print(df.head(10).to_markdown())
except Exception as e:
print(f"Error reading Excel file: {e}")
if __name__ == "__main__":
if len(sys.argv) < 2:
print("Usage: python script.py <file_path>")
else:
read_excel(sys.argv[1])