Google Spreadsheet API problem: memory exceeded
- by Robbert
Hi guys,
Don't know if anyone has experience with the Google Spreadsheets API or the Zend_GData classes but it's worth a go:
When I try to insert a value in a 750 row spreadsheet, it takes ages and then throws an error that my memory limit (which is 128 MB!) was exceeded. I also got this when querying all records of this spreadsheet but this I can imaging because it's quite a lot of data. But why does this happen when inserting a row? That's not too complex, is it? Here's the code I used:
public function insertIntoSpreadsheet($username, $password, $spreadSheetId, $data = array()) {
$service = Zend_Gdata_Spreadsheets::AUTH_SERVICE_NAME;
$client = Zend_Gdata_ClientLogin::getHttpClient($username, $password, $service);
$client->setConfig(array( 'timeout' => 240 ));
$service = new Zend_Gdata_Spreadsheets($client);
if (count($data) == 0) {
die("No valid data");
}
try {
$newEntry = $service->insertRow($data, $spreadSheetId);
return true;
} catch (Exception $e) {
return false;
}
}