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
Implement move tab under sheet #new #570
Comments
@fabceolin That would be a nice feature; in the Sheets API, it is accomplished by modifying the integer If this feature were added, would you like it to be implemented so that you can pass a list of the Worksheet (tab) objects ordered the way you want them ordered, and then # 1) Order the Worksheets the way you'd like, set that order in a single call.
worksheets = my_sheet.worksheets()
worksheets = worksheets.sorted(lambda w: w['title'])
my_sheet.reorder_worksheets(worksheets)
# 2) update index for each worksheet.
worksheets = my_sheet.worksheets()
worksheets = worksheets.sorted(lambda w: w['title'])
for index, wksht in enumerate(worksheets):
wksht.update_index(index) Approach #1 makes only one API call; approach #2 allows fine grained control of the |
The approach 2 solve my problem. I only need to force the new created worksheet to appear at the end. |
Adds `Spreadsheet.reorder_worksheets` with test coverage and documentation. Adds `Worksheet.update_index` with test coverage and documentation.
Hi,
We are working with a sheet with a lot of tabs. New tabs are created without a pattern and manage this manually is time-consuming. We would like the possibility to move tabs, like here:
https://stackoverflow.com/questions/16401749/how-to-move-sheet-within-google-spreadsheeet-using-apps-script)
Thanks
The text was updated successfully, but these errors were encountered: