2016-03-19 10 views
0

シート内にすべての空のセルがある行がある場合。例:google-php-spreadsheet-apiがシートからすべてのデータを返すわけではありません

に空のセルにすべてのデータを取得する方法
cell1  cell2 
row1 : not empty not empty 
row2 : not empty not empty 

cell1  cell2 
row1 : not empty not empty 
row2 : not empty not empty 
row3 : empty  empty 
row4 : not empty not empty 
row5 : not empty not empty 

グーグルは次のようにデータを返しました。私はphp-google-spreadsheet-clientを使用しています。私のコードは:

.... 

$tokenArray = $client->fetchAccessTokenWithAssertion(); 
$accessToken = $tokenArray["access_token"]; 

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

$tokenArray = $client->fetchAccessTokenWithAssertion(); 
$accessToken = $tokenArray["access_token"]; 

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

$spreadsheetService = new Google\Spreadsheet\SpreadsheetService(); 
$spreadsheetFeed = $spreadsheetService->getSpreadsheets(); 
$spreadsheet = $spreadsheetFeed->getByTitle('MySpreadsheet'); 
$worksheetFeed = $spreadsheet->getWorksheets(); 
$worksheet = $worksheetFeed->getByTitle('Sheet 1'); 
$listFeed = $worksheet->getListFeed(); 
foreach ($listFeed->getEntries() as $entry) { 
    $values = $entry->getValues(); 
    $array [] = $values; 
} 
+0

いいえ、私はget csvの方法を使用します –

答えて

0

復帰空のデフォルトでfalseにフィード内の空ではありませんので、のみ返すセルに設定されてと呼ばれるプロパティがあります。セルクエリでこれを 'true'に設定すると、空のセルの値を更新できます。

参照のためにOfficial Google Documentationを使用することができます。ドキュメントにはサンプルコードが含まれています。

+0

ありがとう、しかし私は何も見つかりませんでした –

関連する問題