Class \avadim\FastExcelReader\Csv\CsvReader

Source: 4.5.0 · dd0d48d

On this page


__construct()


php
public function __construct(string $file, $options)

CsvReader constructor

Parameters

  • string $file
  • CsvOptions|array|null $options

close()


php
public function close()

Parameters

None


defaultErrorHandler()


php
public function defaultErrorHandler(int $code, string $error, string $line, 
                                    int $lineNo, int $colNo)

Parameters

  • int $code
  • string $error
  • string $line
  • int $lineNo
  • int $colNo

fromCol()


php
public function fromCol(int $colNum): CsvReader

Parameters

  • int $colNum

fromRow()


php
public function fromRow(int $rowNum): CsvReader

Parameters

  • int $rowNum

getCsvField()


php
public function getCsvField(): ?string

Get next field from CSV file

Parameters

None


getCsvLine()


php
public function getCsvLine(): array|null|false

Get line from CSV file as array of fields (null - empty field, false - EOF)

Parameters

None


getLineNo()


php
public function getLineNo(): int

Physical line number of the row last returned by getCsvLine()/nextRawRow()

One based, and unaffected by skipping: empty and comment lines advance ittoo, so it matches the row addressing the sheet layer expects.

Parameters

None


getOptions()


php
public function getOptions(): CsvOptions

Parameters

None


nextRawRow()


php
public function nextRawRow(): array|false

Read the next physical row of fields, low level

Honours skip-empty-lines and the comment prefix, and returns the raw fieldarray with no column-key or result-mode transformation - that belongs tothe sheet/read-area layer. Returns FALSE at EOF. This is what CsvSheetdrives its rawRows() from, so that the whole read API can be shared withthe XLSX and XLS backends instead of duplicated.

Parameters

None


nextRow()


php
public function nextRow($columnKeys, ?int $resultMode = null, 
                        ?int $rowLimit = 0): ?Generator

Parameters

  • array|bool|int|null $columnKeys
  • int|null $resultMode
  • int|null $rowLimit

onError()


php
public function onError(?callable $handler): CsvReader

Parameters

  • $handler

readRows()


php
public function readRows($columnKeys, ?int $resultMode = null): array

Read rows and return as 2D array

Parameters

  • array|bool|int|null $columnKeys
  • int|null $resultMode

rewind()


php
public function rewind()

Parameters

None


setBufferSize()


php
public function setBufferSize(int $size): CsvReader

Parameters

  • int $size

withHeader()


php
public function withHeader(?array $columnNames = null): CsvReader

Enables header mode

Treats the first row of the CSV file as a header row and returns subsequentrows as associative arrays keyed by column names

Parameters

  • $columnNames

FastExcelReader 4.5.0 · Search this library and version.

Loading search…

Could not load search. Please try again.

No results. Try another word or method name.