Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/auto_archiver/modules/gsheet_feeder_db/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@
"help": "if True the stored files path will include 'workbook_name/worksheet_name/...'",
"type": "bool",
},
"allow_overwrite_of_spreadsheet_cells": {
"default": False,
"help": "If True, the spreadsheet cells will be overwritten with the new values",
"type": "bool",
},
},
"description": """
GsheetsFeederDatabase
Expand Down
12 changes: 11 additions & 1 deletion src/auto_archiver/modules/gsheet_feeder_db/gsheet_feeder_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,17 @@ def done(self, item: Metadata, cached: bool = False) -> None:
def batch_if_valid(col, val, final_value=None):
final_value = final_value or val
try:
if val and gw.col_exists(col) and gw.get_cell(row_values, col) == "":
if val and gw.col_exists(col):
existing_value = gw.get_cell(row_values, col)
if existing_value:
if self.allow_overwrite_of_spreadsheet_cells:
logger.info(f"Overwriting spreadsheet cell {col}={existing_value} with {final_value}")
else:
logger.warning(f"NOT overwriting spreadsheet cell {col}={existing_value} with {final_value}")
return
else:
logger.info(f"No existing value for {col}")

Comment on lines +144 to +154
Copy link
Contributor

@msramalho msramalho Jul 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change feels way too verbose, I don't feel it's useful to have new logs that simply say "this cell is empty" for every cell in a row of cells, so multiple entries per archive. Proposal keeps new logic with current level of verbosity.

Suggested change
if val and gw.col_exists(col):
existing_value = gw.get_cell(row_values, col)
if existing_value:
if self.allow_overwrite_of_spreadsheet_cells:
logger.info(f"Overwriting spreadsheet cell {col}={existing_value} with {final_value}")
else:
logger.warning(f"NOT overwriting spreadsheet cell {col}={existing_value} with {final_value}")
return
else:
logger.info(f"No existing value for {col}")
if val and gw.col_exists(col) and (gw.get_cell(row_values, col) == "" or self.allow_overwrite_of_spreadsheet_cell):

cell_updates.append((row, col, final_value))
except Exception as e:
logger.error(f"Unable to batch {col}={final_value} due to {e}")
Expand Down