# NOT RUN {
if (gs4_has_token()) {
sheet_names <- c("alfa", "bravo", "charlie", "delta", "echo", "foxtrot")
ss <- gs4_create("sheet-relocate-demo", sheets = sheet_names)
sheet_names(ss)
# move one sheet, forwards then backwards
ss %>%
sheet_relocate("echo", .before = "bravo") %>%
sheet_names()
ss %>%
sheet_relocate("echo", .after = "delta") %>%
sheet_names()
# reorder and move multiple sheets to the front
ss %>%
sheet_relocate(list("foxtrot", 4)) %>%
sheet_names()
# put the sheets back in the original order
ss %>%
sheet_relocate(sheet_names) %>%
sheet_names()
# reorder and move multiple sheets to the back
ss %>%
sheet_relocate(c("bravo", "alfa", "echo"), .after = 10) %>%
sheet_names()
# clean up
gs4_find("sheet-relocate-demo") %>%
googledrive::drive_trash()
}
# }
Run the code above in your browser using DataLab