-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add functionality in df_to_sheet to append data to an existing sheet #86
Comments
For now, you could use a workaround: spread = Spread('example')
spread.df_to_sheet(df, sheet="sheet", start=(spread.get_sheet_dims("sheet")[0]+1,1), headers=False) |
Hey! sorry the notifications for this must have slipped through my e-mail. The above workaround def should work well when the data starts in A1 and the column order is the same, but it gets complicated when it doesn't. It seems like an
I imagine the goal of append over replace is simply to reduce the number of API calls and amount of data sent over the wire, which might complicate things because we might still need to fetch data to figure out the answers to the above questions... |
@aiguofer wondering if there is any updated on this? would indeed be ace if the package would be extend with a append_to_sheet for the very reasons you mentioned above. thanks |
Agreed, append and prepend (for adding rows to table sorted in reverse chronological order) functionality would be very useful.
Yes, reading data from spreadsheet into dataframe, updating, then dumping enlarged dataframe into worksheet is a clunky solution, and gets worse as the dataset grows in size. Yes, would probably need to fetch last row of data (for append) or first row of data (for prepend) to figure out where to write, and of course could have optional parameters for user to specify certain characteristics of data to reduce the number of parameters the function needs to determine on its own. |
Hi Diego! Currently in
gspread_pandas.spread.Spread().df_to_sheet()
you are limited to either wiping the sheet or overwriting existing rows using thereplace
parameter. How feasible would it be to add an option to append to an existing sheet instead of just overwriting whenreplace = False
? Based on some googling, I think the answer probably lies invalues_append
within gspread.If you can get me pointed in the right direction I'll see if I can put together a PR.
The text was updated successfully, but these errors were encountered: