Skip to content

Merging google sheets logic #1#3

Open
ojas-uls-dev wants to merge 45 commits intomasterfrom
sheets-logic
Open

Merging google sheets logic #1#3
ojas-uls-dev wants to merge 45 commits intomasterfrom
sheets-logic

Conversation

@ojas-uls-dev
Copy link

Merging google sheets logic

@ojas-uls-dev
Copy link
Author

see also issue #1

Copy link
Member

@ctgraham ctgraham left a comment

Choose a reason for hiding this comment

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

Some questions and some change requests.

ojas-uls-dev and others added 4 commits February 10, 2026 12:18
…ment, when before it was inherited from parent namespace
Remove specific file patterns from .gitignore.
Updated path handling to use os.path.sep for cross-platform compatibility.
Removed commented-out print statement and condition check related to debugging.
@bdgregg bdgregg requested a review from ctgraham February 11, 2026 14:57
@bdgregg
Copy link
Contributor

bdgregg commented Feb 12, 2026

Tested the script to use either a spreadsheet or Google Sheet. currently the script functions as expected.

Copy link
Author

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

Choose a reason for hiding this comment

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

Aside from what clinton mentioned about the erroneous print statement, it looks correct

make-batch-dirs Outdated
error: if manifest.xslx does not exist, then log and fail
"""
manifest_path = os.path.sep.join([batch_path,'manifest.xlsx'])
if not os.path.isfile(manifest_path):
Copy link
Author

Choose a reason for hiding this comment

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

i see the difference between docs and logic, so I'll fix that. It seems like the code is copying file provided by args.xls_file to manifest_path i.e. batch_path/manifest.xslx. This should work fine if args.xls_file exists but manifest.xsl does not exist

make-batch-dirs Outdated
with open(batch_path+"/manifest.csv", "w") as f:
c = csv.writer(f)
for row in sheet.rows:
sheet_value_arr.append([cell.value for cell in row])

Choose a reason for hiding this comment

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

  1. append() will keep allocating more memory, so it might risk a MemoryError if the sheet contain huge data. If sheet_value_arr is not referred in other place, might directly stream rows from openpyxl to CSV.
    2 writer.writerow() could be failed, it might be betterto wrap the overall workflow in try/except,

Copy link
Contributor

Choose a reason for hiding this comment

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

@rzhang152 - nice catch, not sure what "huge data" might look like in this scenario but it would not hurt to add the try/catch @ojas-uls-dev.

Copy link
Author

Choose a reason for hiding this comment

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

I didn't see the values of sheet_value_arr being used anywhere outside the function, and since the data already exists within the dataframe, so the array seemed redundant. b4259cd was my commit to handle it

Copy link
Contributor

@bdgregg bdgregg left a comment

Choose a reason for hiding this comment

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

@ojas-uls-dev - I believe this all looks ok to me.

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.

Add google sheets support to make-batch-dir

4 participants