PDA

View Full Version : Excel VBA ~ Google drive doc



i8890321
03-21-2016, 06:16 AM
I have an Excel file as an database to store all the information of tons of Doc files.
The format like



Created by
Company
Type
File Path


Peter
Three.com
Input
C:\Database\A12asA.doc


John
Smartone
Output
C:\Database\fds123h35.doc


Mary
CMobile
Input
C:\Database\sdf45sd.doc


...
...
...
...



My vba script will open the files i currecntly selected. All the things are workong offline, locally. because i can tell the vba where exactly the files are.

But i want to further improve the code and put all my doc files onto the google drive. so that everyone got the database excel file with the vba script can get the selected doc online.

I know that each google files having a unique ID. but how can i get all the files ID (more than 1k files) from the google drive?
I searched a while on the next and i found some code to help me download the docs from the google drive if i got the IDs of the file.

SamT
03-22-2016, 12:38 PM
GOOGLE DRIVE
http://stackoverflow.com/questions/22199537/how-to-get-driveid-of-created-folder-in-google-drive-android-api
http://lifehacker.com/share-direct-links-to-files-in-google-drive-and-skip-th-1493813665
http://www.labnol.org/internet/direct-links-for-google-drive/28356/
http://stackoverflow.com/questions/15057907/how-to-get-the-file-id-so-i-can-perform-a-download-of-a-file-from-google-drive-a
https://developers.google.com/drive/v2/reference/
http://www.daimto.com/google-drive-api-c/
http://www.codeproject.com/Articles/488185/Working-with-Google-Drive-in-WPF
https://www.nuget.org/packages/Google.Apis.drive.v2

i8890321
03-23-2016, 11:15 AM
Thanks for the reply! I want to make it clear in my google drive i got tons of doc files (in many sub folders).
Some of the links you provided just help me to get one file ID only

But inside this link

I found the following code and i dont know what and where should i paste and try. please give me some noob guide and hints. thanks

// Log the name and id of every file in the user's Drive
function listFiles(){
var files =DriveApp.getFiles();
while( files.hasNext()){
var file = files.next();
Logger.log( file.getName()+' '+ file.getId());
}
}

SamT
03-23-2016, 01:55 PM
for now, you will have to leave off the first part of links. Just start with the "www" part.