Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I'll try to be strict. </p> <p>If you take a look at class "Zend_Gdata_Spreadsheets" you figure that the method insertRow() is written in a very not optimal way. See:</p> <pre><code>public function insertRow($rowData, $key, $wkshtId = 'default') { $newEntry = new Zend_Gdata_Spreadsheets_ListEntry(); $newCustomArr = array(); foreach ($rowData as $k =&gt; $v) { $newCustom = new Zend_Gdata_Spreadsheets_Extension_Custom(); $newCustom-&gt;setText($v)-&gt;setColumnName($k); $newEntry-&gt;addCustom($newCustom); } $query = new Zend_Gdata_Spreadsheets_ListQuery(); $query-&gt;setSpreadsheetKey($key); $query-&gt;setWorksheetId($wkshtId); $feed = $this-&gt;getListFeed($query); $editLink = $feed-&gt;getLink('http://schemas.google.com/g/2005#post'); return $this-&gt;insertEntry($newEntry-&gt;saveXML(), $editLink-&gt;href, 'Zend_Gdata_Spreadsheets_ListEntry'); } </code></pre> <p>In short, it loads your whole spreadsheet just in order to learn this value $editLink->href in order to post new row into your spreadsheet.</p> <p>The cure is to avoid using this method insertRow. Instead, get your $editLink->href once in your code and then insert new rows each time by reproducing the rest of behaviour of this method. I.e, in your code instead of $service->insertRow() use following:</p> <pre><code>//get your $editLink once: $query = new Zend_Gdata_Spreadsheets_ListQuery(); $query-&gt;setSpreadsheetKey($key); $query-&gt;setWorksheetId($wkshtId); $query-&gt;setMaxResults(1); $feed = $service-&gt;getListFeed($query); $editLink = $feed-&gt;getLink('http://schemas.google.com/g/2005#post'); .... //instead of $service-&gt;insertRow: $newEntry = new Zend_Gdata_Spreadsheets_ListEntry(); $newCustomArr = array(); foreach ($rowData as $k =&gt; $v) { $newCustom = new Zend_Gdata_Spreadsheets_Extension_Custom(); $newCustom-&gt;setText($v)-&gt;setColumnName($k); $newEntry-&gt;addCustom($newCustom); } $service-&gt;insertEntry($newEntry-&gt;saveXML(), $editLink-&gt;href, 'Zend_Gdata_Spreadsheets_ListEntry'); </code></pre> <p>Don't forget to encourage this great answer, it costed me few days to figure out. I think ZF is great however sometimes you dont want to rely on their coode too much when it comes to resources optimization.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload