You are here

public function FeedsExcelParser::parse in Feeds Excel 6

Same name and namespace in other branches
  1. 7.2 FeedsExcelParser.inc \FeedsExcelParser::parse()
  2. 7 ExcelParser.inc \FeedsExcelParser::parse()

Implementation of FeedsParser::parse().

Overrides FeedsParser::parse

File

./ExcelParser.inc, line 16

Class

FeedsExcelParser
Parses a given file as a Excel file.

Code

public function parse(FeedsImportBatch $batch, FeedsSource $source) {
  $filepath = $batch
    ->getFilePath();
  _feeds_excel_include_libraries();

  // Read file to object
  $data = new Spreadsheet_Excel_Reader();
  $data
    ->read($filepath);

  // Narrow down the sheets to the configured sheets, and set fixed ranges.
  $sheets = $this
    ->getSheets($data);
  $items = $this
    ->getItems($sheets);

  // Sheet information is stored in batch, for latter token replacement
  $batch->sheets = $this
    ->cleanupSheetsForBatch($sheets);
  $batch
    ->setItems($items);
}