简体   繁体   English

ListFeed仅返回第一行的数据?

[英]ListFeed only returns data for the first row?

I'm trying to read data from a Google Spreadsheet using the PHP Google Spreadsheet Client ( https://github.com/asimlqt/php-google-spreadsheet-client ). 我正在尝试使用PHP Google Spreadsheet Client( https://github.com/asimlqt/php-google-spreadsheet-client )从Google Spreadsheet读取数据。 After much hairpulling, I've got the auth working; 经过大量的梳理后,我可以进行身份​​验证了。 I can add rows to the spreadsheet; 我可以在电子表格中添加行; using CellFeed I can pull individual cell data properly... but the one that's eluding me is using the ListFeed to pull data from rows. 使用CellFeed,我可以正确地提取单个单元格数据...但是让我难以理解的是使用ListFeed从行中提取数据。

It DOES appear to be working, however, it's only pulling data from the first row. 它似乎确实起作用,但是,它只是从第一行提取数据。 Exporting the result with print_r shows that it IS pulling all of the rows, however, it's not breaking the data out into the array. 用print_r导出结果表明它正在拉所有行,但是,并没有将数据分解到数组中。 I've been through the source for the client and I can't see anything wrong in there, either. 我已经遍历了客户端的源代码,也看不到任何错误。 Sigh. 叹。

I've tried it with different worksheets in the same spreadsheet, as well as with a different spreadsheet, just to make sure that it's not something with the data that's preventing it from working properly. 我已经在同一电子表格中的不同工作表以及不同电子表格中对其进行了尝试,只是为了确保它不会妨碍数据正常工作。

Here's what I've got: 这是我得到的:

$serviceRequest = new Google\Spreadsheet\DefaultServiceRequest($accessToken);
Google\Spreadsheet\ServiceRequestFactory::setInstance($serviceRequest);

$spreadsheetService = new Google\Spreadsheet\SpreadsheetService();
$spreadsheetFeed = $spreadsheetService->getSpreadsheets();

$spreadsheet = $spreadsheetFeed->getByTitle('Prime Pubs Test Datasheet');
$worksheetFeed = $spreadsheet->getWorksheets();

$worksheet = $worksheetFeed->getByTitle('Configuration');

$listFeed = $worksheet->getListFeed();

foreach ( $listFeed->getEntries() as $entry ) {
    print_r($entry->getValues());
}

Like I said, it will dump out the first row, but nothing else. 就像我说的那样,它将排满第一行,但没有其他内容。

Here's a snippit of the worksheet... nothing out of the ordinary: http://imgur.com/AIax8tf 这是工作表的摘要...与众不同: http : //imgur.com/AIax8tf

Thanks. 谢谢。

... Yeah. 是的 Apparently it doesn't like blank lines in the spreadsheet. 显然,它不喜欢电子表格中的空白行。 It thinks the sheet is done after that, so it doesn't process any further. 它认为工作表是在此之后完成的,因此不再进行任何处理。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM