/**
  * Insert a new row into this feed
  * 
  * @param array $row
  * 
  * @return void
  */
 public function insert($row)
 {
     $entry = '<entry xmlns="http://www.w3.org/2005/Atom" xmlns:gsx="http://schemas.google.com/spreadsheets/2006/extended">';
     foreach ($row as $colName => $value) {
         $entry .= sprintf('<gsx:%s>%s</gsx:%s>', $colName, $value, $colName);
     }
     $entry .= '</entry>';
     Google_Spreadsheet_ServiceRequestFactory::getInstance()->post($this->getPostUrl(), $entry);
 }
 /**
  * 
  * @param Google_Spreadsheet_Batch_BatchRequest $batchRequest
  * 
  * @return Google_Spreadsheet_Batch_BatchResponse
  */
 public function updateBatch(Google_Spreadsheet_Batch_BatchRequest $batchRequest)
 {
     $xml = $batchRequest->createRequestXml($this);
     $response = Google_Spreadsheet_ServiceRequestFactory::getInstance()->post($this->getBatchUrl(), $xml);
     return new Google_Spreadsheet_Batch_BatchResponse(new SimpleXMLElement($response));
 }
 /**
  * Update the cell value
  *
  * @param string $value
  * 
  * @return null
  */
 public function update($value)
 {
     $entry = sprintf('
         <entry xmlns="http://www.w3.org/2005/Atom"
             xmlns:gs="http://schemas.google.com/spreadsheets/2006">
           <gs:cell row="%u" col="%u" inputValue="%s"/>
         </entry>', $this->row, $this->column, $value);
     $res = Google_Spreadsheet_ServiceRequestFactory::getInstance()->post($this->postUrl, $entry);
     $this->xml = new SimpleXMLElement($res);
 }
 /**
  * [setInstance description]
  * 
  * @param Google_Spreadsheet_ServiceRequestInterface $instance
  */
 public static function setInstance(Google_Spreadsheet_ServiceRequestInterface $instance = null)
 {
     self::$instance = $instance;
 }
 /**
  * Add a new worksheet to this spreadsheet
  * 
  * @param string $title
  * @param int    $rowCount default is 100
  * @param int    $colCount default is 10
  *
  * @return \Google\Spreadsheet\Worksheet
  */
 public function addWorksheet($title, $rowCount = 100, $colCount = 10)
 {
     $entry = sprintf('
         <entry xmlns="http://www.w3.org/2005/Atom" xmlns:gs="http://schemas.google.com/spreadsheets/2006">
             <title>%s</title>
             <gs:rowCount>%u</gs:rowCount>
             <gs:colCount>%u</gs:colCount>
         </entry>', $title, $rowCount, $colCount);
     $response = Google_Spreadsheet_ServiceRequestFactory::getInstance()->post($this->getWorksheetsFeedUrl(), $entry);
     return new Google_Spreadsheet_Worksheet(new SimpleXMLElement($response));
 }
 /**
  * Delete this worksheet
  *
  * @return null
  */
 public function delete()
 {
     Google_Spreadsheet_ServiceRequestFactory::getInstance()->delete($this->getEditUrl());
 }
 /**
  * Returns a cell feed of the specified worksheet.
  * 
  * @see Google_Spreadsheet_Worksheet::getWorksheetId()
  * 
  * @param string $worksheetId
  * 
  * @return Google_Spreadsheet_CellFeed
  */
 public function getCellFeed($worksheetId)
 {
     return new Google_Spreadsheet_CellFeed(Google_Spreadsheet_ServiceRequestFactory::getInstance()->get("feeds/cells/{$worksheetId}/od6/private/full"));
 }
 /**
  * Fetches a single spreadsheet from google drive by id if you decide
  * to store the id locally. This can help reduce api calls.
  *
  * @param string $id the url of the spreadsheet
  *
  * @return Google_Spreadsheet_Spreadsheet
  */
 public function getSpreadsheetById($id)
 {
     return new Google_Spreadsheet_Spreadsheet(new SimpleXMLElement(Google_Spreadsheet_ServiceRequestFactory::getInstance()->get('feeds/spreadsheets/private/full/' . $id)));
 }