/** * Get the heading. * * @param SpreadsheetInterface $workbook * @param $sheetIndex * * @return array */ protected function getHeading(SpreadsheetInterface $workbook, $sheetIndex) { // Fetch the first row $row = $workbook->createRowIterator($sheetIndex, $this->settings->getRowIteratorSettings()); // Set empty labels array $heading = []; // Loop through the cells foreach ($row as $index => $values) { if ($index == $this->settings->getHeadingRow()) { foreach ($values as $cell) { $heading[] = $this->getIndex($cell); } return $heading; } } return $heading; }