node-google-spreadsheet
node-google-spreadsheet copied to clipboard
Deleting method is not the same as deleting row manually in the web browser
Hello everyone! my issue is an aesthetic kinda issue.
I prepare some screenshoot to help my self to explain the problem
Here you can see in the first screen shoot, 3 rows & I would like my bot to delete the row in the middle, so I call my method .delete() to do so.
First screenshoot:
What happen is that I can see in the google sheet history that the value got actually replaced
& the other cell value the row was deleted
so I concluded the row was actually Cleared & move up. Which I totally did not want to do that, it mess my google sheet history, it becomes unreadable, unorganised.
I would like it to behave like "delete row" that we find in the browser Any help would much appreciated.
@NewCoderOnTheBlock did you figure out how to delete the row like it is done on the web? I have the same issue, it clears the row but does not delete it which creates gaps in my sheet
@cesar3030 Hey, here's the code I wrote so the row gets deleted like it is done on the web:
Seems like this should maybe just be an option on how row.delete works? Or perhaps it should be the default? I suspect most folks don't really care...
I think the only difference would be that the dimensions of the sheet change versus just shifting the data up.
@theoephraim I personally care deeply about this matter because if the rows are shifted, it will alter the cells in the Google Sheet history, rendering Google Sheets functionally useless
@NewCoderOnTheBlock - apologies if I sounded dismissive - I meant most folks that aren't paying attention to the history like you wouldn't care if it worked this way (totally removing the row using deleteDimension) instead of shifting the data updward (using deleteRange).
@theoephraim true true!
@NewCoderOnTheBlock Thanks for the answer. I had issues with row shifting so I decided to keep a local state of the rows that I wanted to keep, wipe the spreadsheet and add back the rows I wanted to keep. This allows me to achieve my goal in 2 api calls and fix the row shifting issue.
@cesar3030 that's great! the shifting row was indeed annoying, I did it in one API call. My memory is fuzzy i did it long time ago.
in this line of code it contain my request; const requests = deleteRequests.concat([appendRequests]); (the one u see in my screenshoot)