Change A Spreadsheet Title

| July 24, 2022 | 283 views | Snippets

PhpSpreadsheet (Excel Files)

// Set the properties or metadata of the file
$spreadsheet->getProperties()
    ->setTitle("Put The New Title Of The Spreadsheet Here")
;

Google Sheets API Client Library For PHP (Google Sheets)

$requests = [
    new Google_Service_Sheets_Request([
        'updateSpreadsheetProperties' => [
            'properties'=> [
                'title' => 'Put The New Title Of The Spreadsheet Here'
            ],
            'fields'    => 'title'
        ]
    ])
];

$batchUpdateRequest = new Google_Service_Sheets_BatchUpdateSpreadsheetRequest([
    'requests' => $requests
]);

$response = $service->spreadsheets->batchUpdate($spreadsheetId, $batchUpdateRequest);

You might be interested.

0 Comments

Leave a Reply

Your email address will not be published.