Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -313,21 +313,22 @@ def write_log(sheet_data_dict):
|
|
| 313 |
sheet.append([title])
|
| 314 |
title_cell = sheet.cell(row=sheet.max_row, column=1)
|
| 315 |
title_cell.font = Font(size=14, bold=True) # Set the font size and bold
|
| 316 |
-
|
| 317 |
# Extract the list values and color
|
| 318 |
-
lst
|
|
|
|
| 319 |
|
| 320 |
# Write each item of the list in a new row and apply the color if provided
|
| 321 |
for item in lst:
|
| 322 |
-
sheet.append([item])
|
| 323 |
-
if color:
|
| 324 |
fill = PatternFill(start_color=color, end_color=color, fill_type="solid")
|
| 325 |
cell = sheet.cell(row=sheet.max_row, column=1)
|
| 326 |
cell.fill = fill
|
| 327 |
|
| 328 |
# Remove the default sheet created and save the workbook
|
| 329 |
-
if
|
| 330 |
-
workbook.remove(workbook
|
| 331 |
|
| 332 |
workbook.save('Log.xlsx')
|
| 333 |
|
|
@@ -589,7 +590,7 @@ def process(files,button):
|
|
| 589 |
name = os.path.basename(name)
|
| 590 |
status.append(op_outcome(name,' Failed (Only .csv, .xlsx, .zip are allowed)'+fail))
|
| 591 |
|
| 592 |
-
if len(cleaned_names) > 0
|
| 593 |
write_log(sheet_data)
|
| 594 |
cleaned_names.append('Log.xlsx')
|
| 595 |
final_file = zip_files(cleaned_names)
|
|
|
|
| 313 |
sheet.append([title])
|
| 314 |
title_cell = sheet.cell(row=sheet.max_row, column=1)
|
| 315 |
title_cell.font = Font(size=14, bold=True) # Set the font size and bold
|
| 316 |
+
|
| 317 |
# Extract the list values and color
|
| 318 |
+
lst = data[0] # Extract the list of items to write
|
| 319 |
+
color = data[1] if len(data) > 1 else None # Extract the color if it exists
|
| 320 |
|
| 321 |
# Write each item of the list in a new row and apply the color if provided
|
| 322 |
for item in lst:
|
| 323 |
+
sheet.append([item]) # Write item in a new row
|
| 324 |
+
if color: # If color is provided, apply it to the row
|
| 325 |
fill = PatternFill(start_color=color, end_color=color, fill_type="solid")
|
| 326 |
cell = sheet.cell(row=sheet.max_row, column=1)
|
| 327 |
cell.fill = fill
|
| 328 |
|
| 329 |
# Remove the default sheet created and save the workbook
|
| 330 |
+
if "Sheet" in workbook.sheetnames:
|
| 331 |
+
workbook.remove(workbook["Sheet"])
|
| 332 |
|
| 333 |
workbook.save('Log.xlsx')
|
| 334 |
|
|
|
|
| 590 |
name = os.path.basename(name)
|
| 591 |
status.append(op_outcome(name,' Failed (Only .csv, .xlsx, .zip are allowed)'+fail))
|
| 592 |
|
| 593 |
+
if len(cleaned_names) > 0:
|
| 594 |
write_log(sheet_data)
|
| 595 |
cleaned_names.append('Log.xlsx')
|
| 596 |
final_file = zip_files(cleaned_names)
|