Spaces:
Runtime error
Runtime error
umairahmad89
commited on
Commit
·
191079a
1
Parent(s):
9b53ccd
Add sheetname parameter in update_excel function
Browse files
app.py
CHANGED
@@ -87,10 +87,10 @@ def process_data(csv1_data, csv2_data):
|
|
87 |
except Exception as e:
|
88 |
raise gr.Error(f"Error processing data: {str(e)}")
|
89 |
|
90 |
-
def update_excel(excel_path, processed_data):
|
91 |
try:
|
92 |
excel = openpyxl.load_workbook(excel_path)
|
93 |
-
sheet_0 = excel[
|
94 |
idx = 0
|
95 |
for row in sheet_0.iter_rows(min_row=2):
|
96 |
description = row[0]
|
@@ -124,7 +124,7 @@ def process_files(excel1, excel2, min_row1, max_row1, min_row2, max_row2, sheetn
|
|
124 |
|
125 |
# Update Excel 2
|
126 |
gr.Info("Updating Excel file...")
|
127 |
-
updated_excel = update_excel(excel2, processed_data[1:])
|
128 |
|
129 |
# Save the updated Excel file
|
130 |
gr.Info("Saving updated Excel file...")
|
|
|
87 |
except Exception as e:
|
88 |
raise gr.Error(f"Error processing data: {str(e)}")
|
89 |
|
90 |
+
def update_excel(excel_path, processed_data, sheetname):
|
91 |
try:
|
92 |
excel = openpyxl.load_workbook(excel_path)
|
93 |
+
sheet_0 = excel[sheetname]
|
94 |
idx = 0
|
95 |
for row in sheet_0.iter_rows(min_row=2):
|
96 |
description = row[0]
|
|
|
124 |
|
125 |
# Update Excel 2
|
126 |
gr.Info("Updating Excel file...")
|
127 |
+
updated_excel = update_excel(excel2, processed_data[1:], sheetname)
|
128 |
|
129 |
# Save the updated Excel file
|
130 |
gr.Info("Saving updated Excel file...")
|