/**
  * @param int|array $filters -
  *          int: num of row (1 indexed) if one row needed
  *          array of filters (min-row, max-row - both inclusive) if many rows needed
  * @throws GoogleSpreadsheetException
  */
 public function get($filters = null)
 {
     $this->_init();
     if (is_null($filters)) {
         $filters = array();
     }
     if (!is_array($filters)) {
         $filters = array('min-row' => $filters, 'max-row' => $filters);
     }
     if (empty($filters['min-row']) || $filters['min-row'] < 2) {
         $filters['min-row'] = 2;
     }
     $filters['max-col'] = count($this->headers);
     $data = $this->service->findWorksheetData($this->key, $this->wid, false, $filters);
     $tmp = array();
     $i = $filters['min-row'];
     $cond = true;
     while ($cond) {
         $test = null;
         $row = array();
         foreach ($this->flipHeaders as $name => $in) {
             $key = "R{$i}C{$in}";
             if (array_key_exists($key, $data)) {
                 if (!$test && $data[$key]['val']) {
                     $test = $data[$key]['val'];
                 }
                 $row[$name] = $data[$key];
             } else {
                 $row[$name] = null;
             }
         }
         if ($test) {
             $tmp[$i] = $row;
             $i += 1;
         } else {
             $cond = false;
         }
     }
     return $tmp;
 }
 /**
  * @expectedException Stopsopa\GoogleSpreadsheets\Services\GoogleSpreadsheetException
  * @expectedExceptionMessage Use one of methods setupByServiceAccountKey|setupByOauthClientId|setupByApiKey to initialize service first
  * @expectedExceptionCode null
  */
 public function testNotInitialized()
 {
     $service = new GoogleSpreadsheets();
     $service->findSpreadsheets();
 }