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');
}

Google Sheets API Client Library For PHP

$body = new Google_Service_Sheets_ValueRange([
    'values' => [['Hello A1', 'Hello B1', 'Hello C1', 'Hello D1']]
]);

$params = [
    'valueInputOption' => 'RAW'
];

$result = $service->spreadsheets_values->update($spreadsheetId, 'A1:D1', $body, $params);

[you_might_be_interested ids=”717,729″]


Posted

in

by

Tags:

Leave a Reply

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

Leave a Reply

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