data-raw/setup_statrep_googlesheet.R

#authorize googlesheets
glamr::load_secrets()

#create spreadsheet
gs <- googlesheets4::gs4_create(glue::glue("HFR_DDC-StatusError-Reports"), sheets = c("Submission_Status", "Detailed_Error_Output"))

#move sheet to HFR folder
googledrive::drive_mv(gs, googledrive::as_id("1_jFJOi7fMJ3tABEbRoMWgQjdQBBC4h_c"))

#change permissions to allow USAID users to access
googledrive::drive_share(googledrive::as_id(gs), role = "reader",
                         type = "domain", domain = "usaid.gov", verbose = FALSE)

#check file permissions
googledrive::drive_reveal(googledrive::as_id(gs), "permissions")

#store file id for use in accessing
txt <- glue::glue("#' DDC Status Report Google Sheet ID
                        #'
                        #' @export
                        #' @return google sheet id
                        #'
                        hfr_gs_statrep <- '{gs}'")
writeLines(txt, "R/hfr_gs_statrep.R")
usethis::ui_warn("Updating package documentation and rebuilding")
devtools::document(".", quiet = TRUE)
devtools::build(".", quiet = TRUE)
USAID-OHA-SI/Wavelength documentation built on March 24, 2023, 10:07 a.m.