Google Spreadsheet API problem: memory exceeded

Posted by Robbert on Stack Overflow See other posts from Stack Overflow or by Robbert
Published on 2010-06-09T09:38:58Z Indexed on 2010/06/09 9:42 UTC
Read the original article Hit count: 293

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;
    }
}

© Stack Overflow or respective owner

Related posts about google-app-engine

Related posts about zend-framework