Created
December 9, 2020 11:59
-
-
Save ochui/86e0c0b8b82ba3e211496f8fcaa0d287 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
try { | |
$sSpreadsheetID = '16nfqj7V3Z4r2q4fHmiLXxmph5Ji-4Jw1BPGzYjTz3Kk'; | |
$gclient = new \Google_Client(); | |
$gclient->setApplicationName('Bluebot Google Sheets API PHP'); | |
$gclient->setScopes(\Google_Service_Sheets::SPREADSHEETS); | |
$gclient->setAuthConfig(__DIR__.'/bluetext-adcce8c14228.json'); | |
$gclient->setAccessType('offline'); | |
$service = new \Google_Service_sheets($gclient); | |
$sheet_name = 'test123'; | |
$body = new Google_Service_Sheets_BatchUpdateSpreadsheetRequest(array( | |
'requests' => array( | |
'addSheet' => array( | |
'properties' => array( | |
'title' => $sheet_name | |
) | |
) | |
) | |
)); | |
$result1 = $service->spreadsheets->batchUpdate($sSpreadsheetID,$body); | |
} catch(Exception $ignore) {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment