Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/68.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R 下载googlesheet并在特定路径中创建文件夹进行保存_R_Matrix_Dplyr_Tidyverse - Fatal编程技术网

R 下载googlesheet并在特定路径中创建文件夹进行保存

R 下载googlesheet并在特定路径中创建文件夹进行保存,r,matrix,dplyr,tidyverse,R,Matrix,Dplyr,Tidyverse,我在下面提到了下载google sheet并将其存储在文档中的代码 library(dplyr) library(data.table) library(googlesheets) library(rJava) t.start<-Sys.Date() t.start<-as.character(t.start) #gs_auth(new_user = TRUE) #gs_ls() #gs_auth() as<-gs_title("XYZ") gs_download(as,

我在下面提到了下载google sheet并将其存储在
文档中的代码

library(dplyr)
library(data.table)
library(googlesheets)
library(rJava)

t.start<-Sys.Date()
t.start<-as.character(t.start)

#gs_auth(new_user = TRUE) 
#gs_ls()
#gs_auth()
as<-gs_title("XYZ")
gs_download(as, overwrite = TRUE)
库(dplyr)
库(数据表)
图书馆(谷歌网页)
图书馆(rJava)

t、 开始您可以使用以下代码执行此操作:

# To handle the googlesheets
require(googlesheets)

# For easier date manipulation
require(lubridate)

# Get current time
t <- Sys.time()

# Set your base path and create the basic file structure
base_path <- "E:/My_data/File"
dir.create(paste0(base_path, year(t)))
sub_folder_path <- paste0(base_path, year(t), "/", month(t, label = TRUE), "-", day(t))
dir.create(sub_folder_path)

AB_split <- ifelse(hour(t)<15, "A", "B")
dir.create(paste0(sub_folder_path, "/", AB_split))

# Set your gsheet title and the wanted file-name
ws_title <- "XYZ"
ws_file_name <- paste0(date(t), "_", AB_split, "_", ws_title, ".xlsx")
ws_file_path <- paste0(sub_folder_path, "/", AB_split, "/", ws_file_name)

# Download it
as<-gs_title(ws_title)
gs_download(as, to = ws_file_path, overwrite = TRUE)
#处理谷歌表单
需要(谷歌表单)
#为了更方便地处理日期
要求(润滑)
#获取当前时间

t谢谢,但是我的gsheet名称是静态的,我想在运行代码
后更改它,以防我的错误…谢谢