I made working PHP script to download PDF file from Google Sheet using Google API. However I would like to download only specific sheet (specific gid). Is it possible? I can't find anything about additional parameters in the export. I tried "array('gid' => '123456')" but it's not working (still download whole spreadsheet). Does anyone know how to do this?
$client = new \Google\Client();
$client->setAuthConfig('credentials.json');
$client->addScope(\Google_Service_Drive::DRIVE);
$driveService = new \Google_Service_Drive($client);
$spreadsheetId = '123456789123456789';
$response = $driveService->files->export(
$spreadsheetId,
'application/pdf',
array('alt' => 'media')
);
$content = $response->getBody()->getContents();
file_put_contents('file.pdf',$content);