Skip to content

Instantly share code, notes, and snippets.

@DZuz14
Created December 31, 2017 16:40
Show Gist options
  • Save DZuz14/9c12f363d35133e53afef2b46634d85c to your computer and use it in GitHub Desktop.
Save DZuz14/9c12f363d35133e53afef2b46634d85c to your computer and use it in GitHub Desktop.
Get Values From Google Sheets API
<?php
$exampleEmail = 'mikerosoft@gmail.com';
$result = $this->service->spreadsheets_values->get(SHEET_ID, 'C2:C');
$emails = $result->values;
// $emails will be an array, that you can loop through
for($i = 0; $i < count($emails); $i++) {
if($exampleEmail === $emails[$i][0]) {
// The email exists in the spreadsheet already.
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment