gspread-pandas icon indicating copy to clipboard operation
gspread-pandas copied to clipboard

Ordering sheets within Spread object

Open olivermonaco opened this issue 3 years ago • 1 comments

I've gotten a lot of utility from this package, but I couldn't find that there was a method for reordering or reindexing spreadsheets within a Spread object. I have tried assigning back the Spread.sheets in a new order to the Spread.sheets attribute, but get a can't set attribute error. Would this be a new feature request, or am I missing something?

Thank you

olivermonaco avatar Apr 29 '21 17:04 olivermonaco

Thanks for reporting @olivermonaco. Indeed this is currently not possible, but sounds like a good addition!

I think that setting Spread.sheets is probably a good way to implement this, but there probably needs to be some checks to ensure that all sheets are present when setting the order.

I'll see if I can find some time this week to implement this, or a PR would be welcome!

For anyone that can help tackle this, I think what would be required is to add a @sheets.setter method that makes a batchUpdate request, that does a updateSheetProperties for each sheet and updates the index.

aiguofer avatar May 03 '21 23:05 aiguofer