nagasurendra commited on
Commit
1538ec2
·
verified ·
1 Parent(s): 467bcc5

Create utils/excel_operations.py

Browse files
Files changed (1) hide show
  1. utils/excel_operations.py +13 -0
utils/excel_operations.py ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pandas as pd
2
+
3
+ def read_excel(file_path):
4
+ try:
5
+ return pd.read_excel(file_path).to_dict(orient="records")
6
+ except Exception:
7
+ return []
8
+
9
+ def write_excel(file_path, data):
10
+ try:
11
+ pd.DataFrame(data).to_excel(file_path, index=False)
12
+ except Exception as e:
13
+ print(f"Error writing to {file_path}: {e}")