Last active
September 26, 2025 15:04
-
-
Save saudiwin/9863c79fdd91a7888adb02720ed00855 to your computer and use it in GitHub Desktop.
Automate the creation of google documents for class
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # generate google drive files for class | |
| library(googledrive) | |
| library(readr) | |
| library(readxl) | |
| library(tidyverse) | |
| library(stringr) | |
| # need class roster/blackboard export | |
| class_list <- read_csv("data/cp_dev_fall_2025.csv") | |
| # name of folder to save files in Google Drive (note: you will need to first authenticate with googledrive::drive_auth() | |
| folder_path <- "class_dev_fall_2025" | |
| em <- paste0("Hi, ",class_list$`First Name`[1], | |
| ", see the attached Google Doc that you can use for your policy memo. We'll talk more about it on Thursday. -Bob Kubinec") | |
| # wrap it in a loop for the people in class | |
| lapply(1:nrow(class_list), function(i) { | |
| drive_create(name=str_squish(class_list$`Last Name`[i]), | |
| path=folder_path, | |
| type="document") | |
| em <- paste0("Hi, ",class_list$`First Name`[i], | |
| ", see the attached Google Doc that you can use for your policy memo. We'll talk more about it on Thursday. -Bob Kubinec") | |
| try(drive_share(paste0(folder_path,"/",class_list$`Last Name`[i]), | |
| role = "writer", | |
| type="user", | |
| emailMessage=em, | |
| emailAddress=paste0(class_list$Username[i],"@email.sc.edu"))) | |
| }) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment