PHP/Zend 스크립트를 통해 Google 스프레드 시트에서 모든 행을 가져 오려고합니다. 이것은 내가 사용하고있는 스크립트입니다PHP/Zend/Google 스프레드 시트가 모든 행을 가져 오지 않습니다.
$service = Zend_Gdata_Spreadsheets::AUTH_SERVICE_NAME;
$client = Zend_Gdata_ClientLogin::getHttpClient('xxxxxxxxx', 'xxxxxxx', $service);
$spreadsheetService = new Zend_Gdata_Spreadsheets($client);
// Get spreadsheet key
$spreadsheetsKey = 'xxxxxxxxxxxxx';
$worksheetId = 'xxx';
// Get cell feed
$query = new Zend_Gdata_Spreadsheets_CellQuery();
$query->setSpreadsheetKey($spreadsheetsKey);
$query->setWorksheetId($worksheetId);
$cellFeed = $spreadsheetService->getCellFeed($query);
// Build an array of entries:
$ssRows = array();
$ssRow = array();
$titleRow = array();
$tableRow = 1;
foreach($cellFeed as $cellEntry) {
$row = $cellEntry->cell->getRow();
$col = $cellEntry->cell->getColumn();
$val = $cellEntry->cell->getText();
// Add each row as a new array:
if ($row != $tableRow) {
array_push($ssRows, $ssRow);
$ssRow = array();
// Move to the next row/new array
$tableRow = $row;
}
// Build the array of titles:
if ($row == 1) {
$titleRow[$col] = $val;
}
// Build the array of results with the title as the key:
else {
$key = $titleRow[$col];
$ssRow[$key] = $val;
}
}
// Pass the results array:
return array_reverse($ssRows);
이, 스프레드 시트에서 세부 사항의 대부분 나에게 배열을 구축하지만 항상 마지막 항목을 그리워 - 사람이 내가 잘못 뭐하는 거지 볼 수 있으며,이 스프레드 시트에서 모든 데이터를 가져 오는 더 좋은 방법은 무엇입니까?
양식은 다른 답변을 기준으로 3 부분 형식입니다. 한 부분을 채울 때 양식의 두 번째 부분을 더 빨리 채울 수 있도록 첫 번째 양식의 일부 세부 사항을 미리 입력하여 양식에 URL을 표시하고 싶습니다. 이것은 모두 괜찮습니다, 그것은 중요한 문제가 단순히 누락 된 마지막 항목입니다!
감사합니다.
D' oh는 명백한 대답처럼 보인다, Forrest를 위해 나무를 볼 수 없었다! 목록 피드를 얻으려고했지만 응답이 없으므로 문서가 매우 얇습니다! 문서의 예제 다음에 아무것도 반환하지 않습니다! 리스트 피드가 질의를 받아 들일 때 고통 스러울 수 있습니다. 즉, 모든 것을 얻지 않고 얻은 결과의 나이를 선택할 수 있습니다! – Scoobler