Category: Snippets
-
Add Cell Borders
Are you looking for snippets that will add spreadsheet cell borders? Continue down below to check out the different snippets to use in adding spreadsheet cell borders with PhpSpreadsheet or Google Sheets API PHP Client. PhpSpreadsheet (Excel Files) /// Set borders to A1 $sheet->getStyle(‘A1’)->getBorders()->getTop()->setBorderStyle(\PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THICK); $sheet->getStyle(‘A1’)->getBorders()->getBottom()->setBorderStyle(\PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THICK); $sheet->getStyle(‘A1’)->getBorders()->getLeft()->setBorderStyle(\PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THICK); $sheet->getStyle(‘A1’)->getBorders()->getRight()->setBorderStyle(\PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THICK); Google Sheets API PHP Client $requests = [ […]
-
Unmerge Cells
Are you looking for snippets that will unmerge spreadsheet cells? Check out below the different snippets to use to unmerge cells with PhpSpreadsheet or Google Sheets API PHP Client. PhpSpreadsheet (Excel Files) // Unmerge cells from A1 to D5 $sheet->unmergeCells(‘A1:D5’); Google Sheets API PHP Client $requests = [ new Google_Service_Sheets_Request([ ‘ununmergeCells’ => [ ‘range’ => […]
-
Merge Cells
Are you looking for merge cells snippets? Below are the different snippets you can use to merge cells with PhpSpreadsheet or Google Sheets API PHP Client. PhpSpreadsheet (Excel Files) // Merge cells from A1 to D5 $sheet->mergeCells(‘A1:D5’); Google Sheets API PHP Client $requests = [ new Google_Service_Sheets_Request([ ‘mergeCells’ => [ ‘range’ => [‘startRowIndex’=> 1, ‘endRowIndex’=> […]
-
Write Cell Data Horizontally
Are you looking for spreadsheet snippets to write cell data horizontally? Below are the different snippets you can use to write spreadsheet cell data horizontally with PhpSpreadsheet or Google Sheets API PHP Client. PhpSpreadsheet (Excel Files) // Set cell values for A1-D1 foreach (range(‘A’, ‘D’) as $letter) { $sheet->setCellValue($letter . ‘1’, $letter . ‘1’); } […]
-
Change A Spreadsheet Title
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 […]