25 lines
679 B
Python
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])
|