You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have been attempting to use a "for loop" in conjunction with "drive_download" to download a list of files from Google Drive one at a time, manipulate the files, save a new CSV file, and then delete the file that I downloaded from local storage. When the files in the list contain plus symbols (+) in the name, the loop quits and I get the following error message: Error: 'file' does not identify at least one Drive file.
To verify this, I have created two files, Test.xlsx, and Test+.xlsx (I use CSV versions of these files), which contain the following text in cell A1:
This;is;a;test
If the Test+ file is not present in Google Drive, the code will run fine. If it is present, the error message is shown. Note that I have not specified a working directory since I am working in R studio using a project file.
Testfile<- drive_find(pattern="Test")#Identifies all Delay Results filesTestfilenames<- unlist(Testfile[,1])#Removes extraneous columns from drive_find resultsfor(iinTestfilenames){
drive_download(as.character(paste(i)))#Downloads file from Google Drive based on list of file namesa<- as.data.frame(cSplit(a,'V1',sep=";"))#Equivalent of "Text To Columns" in Excela$filename<-i#Adds a column with the file name in case the files need to be combined in the future
write.csv(a, as.character(paste(i, ".csv", sep="")))#Creates a new CSV file
unlink(i)#Deletes original file from local drive
}
I have been attempting to use a "for loop" in conjunction with "drive_download" to download a list of files from Google Drive one at a time, manipulate the files, save a new CSV file, and then delete the file that I downloaded from local storage. When the files in the list contain plus symbols (+) in the name, the loop quits and I get the following error message: Error: 'file' does not identify at least one Drive file.
To verify this, I have created two files, Test.xlsx, and Test+.xlsx (I use CSV versions of these files), which contain the following text in cell A1:
This;is;a;test
If the Test+ file is not present in Google Drive, the code will run fine. If it is present, the error message is shown. Note that I have not specified a working directory since I am working in R studio using a project file.
Test+.xlsx
Test.xlsx
The text was updated successfully, but these errors were encountered: