I’m trying to use Google Drive in my Drupal application.
I need to open a spreadsheet (already in Drive account) in this application.
Here is how I am setting this up:
1.) I build the service by calling the buildService function (code provided)
function buildService(){
$key=
file_get_contents(TRUE_PATH.'9e01fd1414aa082fadeec316161eb7028558fbdeprivatekey.p12');
$auth = new Google_AssertionCredentials(
SERVICE_ACCOUNT_EMAIL,
//array(DRIVE_SCOPE),
$key);
$client = new Google_Client();
$client->setUseObjects(true);
$client->setAssertionCredentials($auth);
return new Google_DriveService($client);
}
2.) on the other side, I grab the return: $service = buildService();
How would I get my spreadsheet from Drive after building the service? I know the url for the spreadsheet, but I don’t know the fileId (not sure where to find this).
I apologize if this is a stupid question. Any help is greatly appreciated.
Thanks,
Alex
The url of your spreadsheet should look like the following:
Essentially, the value of the
keyquery parameter is the file id that can be used with the Drive API.