Configuration
This chapter describes the parameters that can be used to configure the CSV connector service.
filename
- Type
- string
- Description
-
This is the name of the file to read. The reference to the file can use any of the following syntaxes:
- absolute file path:
/var/
(within the TYPO3 root path orfoo/ web/ fileadmin/ import/ bar. csv TYPO3_
)CONF_ VARS [BE] [lock Root Path] - file path relative to the TYPO3 root:
fileadmin/
import/ foo. csv - file path using
EXT:
:EXT:
foo/ Resources/ Private/ Data/ bar. csv - fully qualified URL, e.g.
http://
www. example. com/ foo. csv - FAL reference with storage ID and file identifier:
FAL:
2:/ foo. csv - custom syntax:
MYKEY:
, see Connector Serviceswhatever_ you_ want
- absolute file path:
method
- Type
- string
- Description
- Method used to get the file (GET, POST, or whatever else is relevant). This parameter is optional and the method defaults to GET.
headers
- Type
- array
- Description
- Key-value pairs of headers that should be sent along with the request.
- Example
-
Example headers for setting an alternate user agent and defining what reponse format to accept.
'headers' => [ 'User-Agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:75.0) Gecko/20100101 Firefox/75.0', 'Accept' => 'text/csv', ]
Copied!
encoding
- Type
- string
- Description
- Encoding of the data found in the file. This value must match any of the encoding values recognized by the PHP libray "mbstring". See https://www.php.net/manual/en/mbstring.supported-encodings.php
delimiter
- Type
- string
- Description
- The character used to separate the various fields on each line of the file.
- Default
- , (comma)
text_qualifier
- Type
- string
- Description
- The character used to wrap text fields.
- Default
- " (double quote)
skip_rows
- Type
- int
- Description
-
The number of rows to ignore at the beginning of the file.
This has an additional special meaning if larger than 0. The CSV connector will take the first line and read column labels from it. These labels will then be used as keys in the array of data returned. The other skipped lines are totally ignored.
Note
This does not apply when using the
fetch
method.Raw () - Default
- 0
locale
- Type
- int
- Description
-
A locale string, according to the locales available on the server.
This may not be necessary. However it may happen to be needed to handle badly-encoded files for example. The symptom is special characters – like umlauts – disappearing in the imported data.