Change A Spreadsheet Title

Posted

in

by

Are you looking for snippets to change a spreadsheet title?

Here are the different snippets you can use to change spreadsheet title with PhpSpreadsheet or Google Sheets API PHP Client.

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

$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 ids=”709,94″]


Posted

in

by

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *

Latest Tutorials

Web Dev Tutorials