addCsv
addCsv
ADVANCED / PREMIUM
BASIC
Adds CSV contents.
Description
public addCsv($csv, $position, $options = array())
This method imports a CSV into the current Excel spreadsheet.
When importing a CSV, a new table is generated with the CSV contents.
Parameters
csv
CSV path.
position
Cell position in the active sheet: A1, C3, AB7...
options
The possible keys and values are:
Key | Type | Description |
---|---|---|
delimiter | string | Field separator. Default as , |
enclosure | string | Field enclosure character. Default as " |
escape | string | Escape character. Default as \ |
firstRowAsHeader | bool | If true, the first row is added as table header. Default as false |
headerCellStyles | array | If firstRowAsHeader is true, apply the cell styles to the header. Default as empty. Check addCell to see all available options. |
headerTextStyles | array | If firstRowAsHeader is true, apply the text styles to the header. Default as empty. Check addCell to see all available options. |
Exceptions
CSV doesn't exist.
CSV format is not supported.
Method not available in license.
Release notes
- phpxlsx 2.0:
- new method.