# NOT RUN {
if (gs4_has_token()) {
ss_aaa <- gs4_create(
"sheet-copy-demo-aaa",
sheets = list(iris = head(iris), chickwts = head(chickwts))
)
# copy 'iris' sheet within existing Sheet, accept autogenerated name
ss_aaa %>%
sheet_copy()
# copy 'iris' sheet within existing Sheet
# specify new sheet's name and location
ss_aaa %>%
sheet_copy(to_sheet = "iris-the-sequel", .after = 1)
# make a second Sheet
ss_bbb <- gs4_create("sheet-copy-demo-bbb")
# copy 'chickwts' sheet from first Sheet to second
# accept auto-generated name and default location
ss_aaa %>%
sheet_copy("chickwts", to_ss = ss_bbb)
# copy 'chickwts' sheet from first Sheet to second,
# WITH a specific name and into a specific location
ss_aaa %>%
sheet_copy(
"chickwts",
to_ss = ss_bbb, to_sheet = "chicks-two", .before = 1
)
# clean up
gs4_find("sheet-copy-demo") %>%
googledrive::drive_trash()
}
# }
Run the code above in your browser using DataLab