Write Cell Data Horizontally
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 (Google Sheets)
$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.
Learn How To Write Google Sheets Data To A Single Range Horizontally Using Google Sheets API PHP Client
Google Sheets API PHP Client