Skip to content

Updated read_google_sheet function to allow for empty columns at the …#8

Open
bdgregg wants to merge 2 commits into
masterfrom
6-empty-columns-google-sheet
Open

Updated read_google_sheet function to allow for empty columns at the …#8
bdgregg wants to merge 2 commits into
masterfrom
6-empty-columns-google-sheet

Conversation

@bdgregg

@bdgregg bdgregg commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

…end of the Google Sheet rows.

@ojas-uls-dev ojas-uls-dev left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Looks correct. Maybe extract the logic for padding rows into a different function and call it as a function.

Something like

def pad_rows(data):
    ...
    return headers, rows

def read_google_sheet(...):
    ...
    headers, rows = pad_rows(data)
    df = pd.DataFrame(rows, columns = headers)
    return df

@bdgregg

bdgregg commented Jul 10, 2026

Copy link
Copy Markdown
Contributor Author

@ojas-uls-dev, I like what you suggested! I'll see about doing this.

@bdgregg

bdgregg commented Jul 10, 2026

Copy link
Copy Markdown
Contributor Author

@ojas-uls-dev, I believe I have incorporated your suggestion. Can you review my recent change?

@ojas-uls-dev

Copy link
Copy Markdown

That looks correct. Another thing I had a question about was that if there needs to be error checking in case read_google_sheet returns an empty dataframe. Currently, add_columns would just add the required columns into the sheet with default value (None), and the script continues as it would. This is fine if this is intended, but at least a log message might be useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update scan-batch-dir to allow for empty columns at end of the Google Sheet.

2 participants