add sync data setting

This commit is contained in:
arifal hidayat
2025-02-17 01:52:49 +07:00
parent 59e9431b2d
commit 154b7f40df
4 changed files with 65 additions and 13 deletions

View File

@@ -140,4 +140,13 @@ class GoogleSheetService
throw $e;
}
}
public function get_data_by_sheet($no_sheet = 1){
$spreadsheet = $this->service->spreadsheets->get($this->spreadsheetID);
$sheets = $spreadsheet->getSheets();
$sheetTitle = $sheets[$no_sheet]->getProperties()->getTitle();
$range = "{$sheetTitle}";
$response = $this->service->spreadsheets_values->get($this->spreadsheetID, $range);
$values = $response->getValues();
return!empty($values)? $values : [];
}
}