PHPExcel Reader Example #15
Simple File Reader for Tab-Separated Value File using the Advanced Value Binder
Loading file example1.tsv into WorkSheet #1 using IOFactory with a defined reader type of CSV
1 worksheet loaded
Worksheet #0 -> example1.tsv (Formatted)
array(4) {
[1]=>
array(9) {
["A"]=>
string(10) "First Name"
["B"]=>
string(9) "Last Name"
["C"]=>
string(11) "Nationality"
["D"]=>
string(6) "Gender"
["E"]=>
string(13) "Date of Birth"
["F"]=>
string(13) "Time of Birth"
["G"]=>
string(9) "Date/Time"
["H"]=>
string(9) "PHP Coder"
["I"]=>
string(11) "Sanity %Age"
}
[2]=>
array(9) {
["A"]=>
string(4) "Mark"
["B"]=>
string(5) "Baker"
["C"]=>
string(7) "British"
["D"]=>
string(1) "M"
["E"]=>
string(10) "1960-12-19"
["F"]=>
string(4) "1:30"
["G"]=>
float(22269.0625)
["H"]=>
bool(true)
["I"]=>
string(6) "32.00%"
}
[3]=>
array(9) {
["A"]=>
string(4) "Toni"
["B"]=>
string(5) "Baker"
["C"]=>
string(7) "British"
["D"]=>
string(1) "F"
["E"]=>
string(10) "1950-11-24"
["F"]=>
string(5) "20:00"
["G"]=>
float(18591.83333333333)
["H"]=>
bool(false)
["I"]=>
string(6) "95.00%"
}
[4]=>
array(9) {
["A"]=>
string(6) "Rachel"
["B"]=>
string(5) "Baker"
["C"]=>
string(7) "British"
["D"]=>
string(1) "F"
["E"]=>
string(10) "1982-12-07"
["F"]=>
string(4) "0:15"
["G"]=>
float(30292.01041666667)
["H"]=>
bool(false)
["I"]=>
string(7) "100.00%"
}
}
Worksheet #0 -> example1.tsv (Unformatted)
array(4) {
[1]=>
array(9) {
["A"]=>
string(10) "First Name"
["B"]=>
string(9) "Last Name"
["C"]=>
string(11) "Nationality"
["D"]=>
string(6) "Gender"
["E"]=>
string(13) "Date of Birth"
["F"]=>
string(13) "Time of Birth"
["G"]=>
string(9) "Date/Time"
["H"]=>
string(9) "PHP Coder"
["I"]=>
string(11) "Sanity %Age"
}
[2]=>
array(9) {
["A"]=>
string(4) "Mark"
["B"]=>
string(5) "Baker"
["C"]=>
string(7) "British"
["D"]=>
string(1) "M"
["E"]=>
float(22269)
["F"]=>
float(0.0625)
["G"]=>
float(22269.0625)
["H"]=>
bool(true)
["I"]=>
float(0.32)
}
[3]=>
array(9) {
["A"]=>
string(4) "Toni"
["B"]=>
string(5) "Baker"
["C"]=>
string(7) "British"
["D"]=>
string(1) "F"
["E"]=>
float(18591)
["F"]=>
float(0.8333333333333334)
["G"]=>
float(18591.83333333333)
["H"]=>
bool(false)
["I"]=>
float(0.95)
}
[4]=>
array(9) {
["A"]=>
string(6) "Rachel"
["B"]=>
string(5) "Baker"
["C"]=>
string(7) "British"
["D"]=>
string(1) "F"
["E"]=>
float(30292)
["F"]=>
float(0.01041666666666667)
["G"]=>
float(30292.01041666667)
["H"]=>
bool(false)
["I"]=>
float(1)
}
}
Worksheet #0 -> example1.tsv (Raw)
array(4) {
[1]=>
array(9) {
["A"]=>
string(10) "First Name"
["B"]=>
string(9) "Last Name"
["C"]=>
string(11) "Nationality"
["D"]=>
string(6) "Gender"
["E"]=>
string(13) "Date of Birth"
["F"]=>
string(13) "Time of Birth"
["G"]=>
string(9) "Date/Time"
["H"]=>
string(9) "PHP Coder"
["I"]=>
string(11) "Sanity %Age"
}
[2]=>
array(9) {
["A"]=>
string(4) "Mark"
["B"]=>
string(5) "Baker"
["C"]=>
string(7) "British"
["D"]=>
string(1) "M"
["E"]=>
float(22269)
["F"]=>
float(0.0625)
["G"]=>
string(6) "=E2+F2"
["H"]=>
bool(true)
["I"]=>
float(0.32)
}
[3]=>
array(9) {
["A"]=>
string(4) "Toni"
["B"]=>
string(5) "Baker"
["C"]=>
string(7) "British"
["D"]=>
string(1) "F"
["E"]=>
float(18591)
["F"]=>
float(0.8333333333333334)
["G"]=>
string(6) "=E3+F3"
["H"]=>
bool(false)
["I"]=>
float(0.95)
}
[4]=>
array(9) {
["A"]=>
string(6) "Rachel"
["B"]=>
string(5) "Baker"
["C"]=>
string(7) "British"
["D"]=>
string(1) "F"
["E"]=>
float(30292)
["F"]=>
float(0.01041666666666667)
["G"]=>
string(6) "=E4+F4"
["H"]=>
bool(false)
["I"]=>
float(1)
}
}