Integrating forms with Google Sheets for data collection
Data from website forms automatically goes into Google Sheets — without manual transfer, without additional tools. The spreadsheet becomes a live base of leads, requests, or survey responses.
Google Sheets API v4
use Google\Client;
use Google\Service\Sheets;
class GoogleSheetsService
{
private Sheets $sheets;
private string $spreadsheetId;
public function appendRow(array $data): void
{
$values = [
now()->format('d.m.Y H:i'),
$data['name'],
$data['email'],
$data['phone'] ?? '',
$data['message'] ?? '',
$data['utm_source'] ?? '',
];
$this->sheets->spreadsheets_values->append(
$this->spreadsheetId,
'Requests!A:F',
new Sheets\ValueRange(['values' => [$values]]),
['valueInputOption' => 'USER_ENTERED']
);
}
}
A service account from Google receives access to the spreadsheet: create in Google Cloud Console, download JSON key, grant edit rights to the spreadsheet via "Share".
Implementation time: 1 working day.







