Google\Spreadsheet\Worksheet::getCellFeed PHP Method

getCellFeed() public method

Get the cell feed of this worksheet
public getCellFeed ( array $query = [] ) : CellFeed
$query array
return CellFeed
    public function getCellFeed(array $query = [])
    {
        $feedUrl = $this->getCellFeedUrl();
        if (count($query) > 0) {
            $feedUrl .= "?" . http_build_query($query);
        }
        $res = ServiceRequestFactory::getInstance()->get($feedUrl);
        return new CellFeed(new \SimpleXMLElement($res));
    }

Usage Example

 protected function readTableDefinition(Worksheet $worksheet)
 {
     $checks = Config::get('laravel-migrate-build::build.available_sheet_check');
     $cellFeed = $worksheet->getCellFeed();
     if ($this->getCellString($cellFeed, $checks['row'], $checks['col']) != $checks['value']) {
         return false;
     }
     $definition = [];
     $definition['tableName'] = $this->getCellString($cellFeed, 2, 15);
     $definition['increments'] = $this->getCellFlag($cellFeed, 4, 5);
     $definition['timestamps'] = $this->getCellFlag($cellFeed, 4, 10);
     $definition['publishes'] = $this->getCellFlag($cellFeed, 4, 15);
     $definition['softDeletes'] = $this->getCellFlag($cellFeed, 4, 20);
     $definition['engine'] = $this->getCellString($cellFeed, 4, 29);
     $definition['rowFormat'] = $this->getCellString($cellFeed, 4, 43);
     $columns = [];
     foreach (range(7, $worksheet->getRowCount()) as $row) {
         $no = $this->getCellNumber($cellFeed, $row, 1);
         if ($no == 0) {
             break;
         }
         $ignore = $this->getCellFlag($cellFeed, $row, 37);
         if ($ignore) {
             continue;
         }
         $columns[] = ['label' => $this->getCellString($cellFeed, $row, 3), 'name' => $this->getCellString($cellFeed, $row, 12), 'type' => $this->getCellString($cellFeed, $row, 21), 'size' => $this->getCellNumber($cellFeed, $row, 26, null), 'default' => $this->getCellValue($cellFeed, $row, 28), 'index' => $this->getCellFlag($cellFeed, $row, 31), 'unique' => $this->getCellFlag($cellFeed, $row, 33), 'nullable' => $this->getCellFlag($cellFeed, $row, 35)];
     }
     $definition['columns'] = $columns;
     $definition['keyName'] = sprintf("create_%s_table", $definition['tableName']);
     $definition['className'] = sprintf("Create%sTable", studly_case($definition['tableName']));
     return $definition;
 }