PHPExcel Reader Example #14
Reading a Large CSV file in "Chunks" to split across multiple Worksheets
Loading file example2.csv using IOFactory with a defined reader type of CSV
Loading WorkSheet #1 using configurable filter for headings row 1 and for rows 2 to 101
Loading WorkSheet #2 using configurable filter for headings row 1 and for rows 102 to 201
Loading WorkSheet #3 using configurable filter for headings row 1 and for rows 202 to 301
3 worksheets loaded
Worksheet #0 -> Country Data #1
array(101) {
[1]=>
array(4) {
["A"]=>
string(4) "City"
["B"]=>
string(7) "Country"
["C"]=>
string(8) "Latitude"
["D"]=>
string(9) "Longitude"
}
[2]=>
array(4) {
["A"]=>
string(5) "Kabul"
["B"]=>
string(11) "Afghanistan"
["C"]=>
float(34.528455)
["D"]=>
float(69.171703)
}
[3]=>
array(4) {
["A"]=>
string(6) "Tirane"
["B"]=>
string(7) "Albania"
["C"]=>
float(41.33)
["D"]=>
float(19.82)
}
[4]=>
array(4) {
["A"]=>
string(7) "Algiers"
["B"]=>
string(7) "Algeria"
["C"]=>
float(36.752887)
["D"]=>
float(3.042048)
}
[5]=>
array(4) {
["A"]=>
string(9) "Pago Pago"
["B"]=>
string(14) "American Samoa"
["C"]=>
float(-14.27933)
["D"]=>
float(-170.700897)
}
[6]=>
array(4) {
["A"]=>
string(16) "Andorra la Vella"
["B"]=>
string(7) "Andorra"
["C"]=>
float(42.507531)
["D"]=>
float(1.521816)
}
[7]=>
array(4) {
["A"]=>
string(6) "Luanda"
["B"]=>
string(6) "Angola"
["C"]=>
float(-8.838333)
["D"]=>
float(13.234444)
}
[8]=>
array(4) {
["A"]=>
string(12) "Buenos Aires"
["B"]=>
string(9) "Argentina"
["C"]=>
float(-34.608417)
["D"]=>
float(-58.373161)
}
[9]=>
array(4) {
["A"]=>
string(7) "Yerevan"
["B"]=>
string(7) "Armenia"
["C"]=>
float(40.183333)
["D"]=>
float(44.516667)
}
[10]=>
array(4) {
["A"]=>
string(10) "Oranjestad"
["B"]=>
string(5) "Aruba"
["C"]=>
float(12.52458)
["D"]=>
float(-70.026459)
}
[11]=>
array(4) {
["A"]=>
string(8) "Canberra"
["B"]=>
string(9) "Australia"
["C"]=>
float(-35.3075)
["D"]=>
float(149.124417)
}
[12]=>
array(4) {
["A"]=>
string(6) "Vienna"
["B"]=>
string(7) "Austria"
["C"]=>
float(48.208333)
["D"]=>
float(16.373056)
}
[13]=>
array(4) {
["A"]=>
string(4) "Baku"
["B"]=>
string(10) "Azerbaijan"
["C"]=>
float(40.379571)
["D"]=>
float(49.891233)
}
[14]=>
array(4) {
["A"]=>
string(6) "Nassau"
["B"]=>
string(7) "Bahamas"
["C"]=>
float(25.06)
["D"]=>
float(-77.345)
}
[15]=>
array(4) {
["A"]=>
string(6) "Manama"
["B"]=>
string(7) "Bahrain"
["C"]=>
float(26.216667)
["D"]=>
float(50.583333)
}
[16]=>
array(4) {
["A"]=>
string(5) "Dhaka"
["B"]=>
string(10) "Bangladesh"
["C"]=>
float(23.709921)
["D"]=>
float(90.407143)
}
[17]=>
array(4) {
["A"]=>
string(10) "Bridgetown"
["B"]=>
string(8) "Barbados"
["C"]=>
float(13.096111)
["D"]=>
float(-59.608333)
}
[18]=>
array(4) {
["A"]=>
string(5) "Minsk"
["B"]=>
string(7) "Belarus"
["C"]=>
float(53.9)
["D"]=>
float(27.566667)
}
[19]=>
array(4) {
["A"]=>
string(8) "Brussels"
["B"]=>
string(7) "Belgium"
["C"]=>
float(50.846281)
["D"]=>
float(4.354727)
}
[20]=>
array(4) {
["A"]=>
string(8) "Belmopan"
["B"]=>
string(6) "Belize"
["C"]=>
float(17.251389)
["D"]=>
float(-88.766944)
}
[21]=>
array(4) {
["A"]=>
string(7) "Thimphu"
["B"]=>
string(6) "Bhutan"
["C"]=>
float(27.466667)
["D"]=>
float(89.641667)
}
[22]=>
array(4) {
["A"]=>
string(6) "La Paz"
["B"]=>
string(7) "Bolivia"
["C"]=>
float(-16.49901)
["D"]=>
float(-68.146248)
}
[23]=>
array(4) {
["A"]=>
string(8) "Sarajevo"
["B"]=>
string(22) "Bosnia and Herzegovina"
["C"]=>
float(43.8476)
["D"]=>
float(18.3564)
}
[24]=>
array(4) {
["A"]=>
string(8) "Gaborone"
["B"]=>
string(8) "Botswana"
["C"]=>
float(-24.65411)
["D"]=>
float(25.908739)
}
[25]=>
array(4) {
["A"]=>
string(8) "Brasilia"
["B"]=>
string(6) "Brazil"
["C"]=>
float(-15.780148)
["D"]=>
float(-47.92917)
}
[26]=>
array(4) {
["A"]=>
string(9) "Road Town"
["B"]=>
string(22) "British Virgin Islands"
["C"]=>
float(18.433333)
["D"]=>
float(-64.616667)
}
[27]=>
array(4) {
["A"]=>
string(19) "Bandar Seri Begawan"
["B"]=>
string(17) "Brunei Darussalam"
["C"]=>
float(4.9431)
["D"]=>
float(114.9425)
}
[28]=>
array(4) {
["A"]=>
string(5) "Sofia"
["B"]=>
string(8) "Bulgaria"
["C"]=>
float(42.697626)
["D"]=>
float(23.322284)
}
[29]=>
array(4) {
["A"]=>
string(11) "Ouagadougou"
["B"]=>
string(12) "Burkina Faso"
["C"]=>
float(12.364637)
["D"]=>
float(-1.533864)
}
[30]=>
array(4) {
["A"]=>
string(9) "Bujumbura"
["B"]=>
string(7) "Burundi"
["C"]=>
float(-3.361378)
["D"]=>
float(29.359878)
}
[31]=>
array(4) {
["A"]=>
string(10) "Phnom Penh"
["B"]=>
string(8) "Cambodia"
["C"]=>
float(11.55)
["D"]=>
float(104.916667)
}
[32]=>
array(4) {
["A"]=>
string(7) "Yaounde"
["B"]=>
string(8) "Cameroon"
["C"]=>
float(3.866667)
["D"]=>
float(11.516667)
}
[33]=>
array(4) {
["A"]=>
string(6) "Ottawa"
["B"]=>
string(6) "Canada"
["C"]=>
float(45.423494)
["D"]=>
float(-75.697933)
}
[34]=>
array(4) {
["A"]=>
string(5) "Praia"
["B"]=>
string(10) "Cape Verde"
["C"]=>
float(14.920833)
["D"]=>
float(-23.508333)
}
[35]=>
array(4) {
["A"]=>
string(11) "George Town"
["B"]=>
string(14) "Cayman Islands"
["C"]=>
float(19.286932)
["D"]=>
float(-81.367439)
}
[36]=>
array(4) {
["A"]=>
string(6) "Bangui"
["B"]=>
string(24) "Central African Republic"
["C"]=>
float(4.361698)
["D"]=>
float(18.555975)
}
[37]=>
array(4) {
["A"]=>
string(9) "N'Djamena"
["B"]=>
string(4) "Chad"
["C"]=>
float(12.104797)
["D"]=>
float(15.044506)
}
[38]=>
array(4) {
["A"]=>
string(8) "Santiago"
["B"]=>
string(5) "Chile"
["C"]=>
float(-33.42536)
["D"]=>
float(-70.566466)
}
[39]=>
array(4) {
["A"]=>
string(7) "Beijing"
["B"]=>
string(5) "China"
["C"]=>
float(39.904667)
["D"]=>
float(116.408198)
}
[40]=>
array(4) {
["A"]=>
string(6) "Bogota"
["B"]=>
string(8) "Colombia"
["C"]=>
float(4.647302)
["D"]=>
float(-74.096268)
}
[41]=>
array(4) {
["A"]=>
string(6) "Moroni"
["B"]=>
string(7) "Comoros"
["C"]=>
float(-11.717216)
["D"]=>
float(43.247315)
}
[42]=>
array(4) {
["A"]=>
string(11) "Brazzaville"
["B"]=>
string(5) "Congo"
["C"]=>
float(-4.266667)
["D"]=>
float(15.283333)
}
[43]=>
array(4) {
["A"]=>
string(8) "San Jose"
["B"]=>
string(10) "Costa Rica"
["C"]=>
float(9.933333)
["D"]=>
float(-84.083333)
}
[44]=>
array(4) {
["A"]=>
string(12) "Yamoussoukro"
["B"]=>
string(13) "Cote d'Ivoire"
["C"]=>
float(6.816667)
["D"]=>
float(-5.283333)
}
[45]=>
array(4) {
["A"]=>
string(6) "Zagreb"
["B"]=>
string(7) "Croatia"
["C"]=>
float(45.814912)
["D"]=>
float(15.978515)
}
[46]=>
array(4) {
["A"]=>
string(6) "Havana"
["B"]=>
string(4) "Cuba"
["C"]=>
float(23.133333)
["D"]=>
float(-82.366667)
}
[47]=>
array(4) {
["A"]=>
string(7) "Nicosia"
["B"]=>
string(6) "Cyprus"
["C"]=>
float(35.166667)
["D"]=>
float(33.366667)
}
[48]=>
array(4) {
["A"]=>
string(6) "Prague"
["B"]=>
string(14) "Czech Republic"
["C"]=>
float(50.087811)
["D"]=>
float(14.42046)
}
[49]=>
array(4) {
["A"]=>
string(8) "Kinshasa"
["B"]=>
string(5) "Congo"
["C"]=>
float(-4.325)
["D"]=>
float(15.322222)
}
[50]=>
array(4) {
["A"]=>
string(10) "Copenhagen"
["B"]=>
string(7) "Denmark"
["C"]=>
float(55.676294)
["D"]=>
float(12.568116)
}
[51]=>
array(4) {
["A"]=>
string(8) "Djibouti"
["B"]=>
string(8) "Djibouti"
["C"]=>
float(11.588)
["D"]=>
float(43.145)
}
[52]=>
array(4) {
["A"]=>
string(6) "Roseau"
["B"]=>
string(8) "Dominica"
["C"]=>
float(15.301389)
["D"]=>
float(-61.388333)
}
[53]=>
array(4) {
["A"]=>
string(13) "Santo Domingo"
["B"]=>
string(18) "Dominican Republic"
["C"]=>
float(18.5)
["D"]=>
float(-69.983333)
}
[54]=>
array(4) {
["A"]=>
string(4) "Dili"
["B"]=>
string(10) "East Timor"
["C"]=>
float(-8.566667)
["D"]=>
float(125.566667)
}
[55]=>
array(4) {
["A"]=>
string(5) "Quito"
["B"]=>
string(7) "Ecuador"
["C"]=>
float(-0.229498)
["D"]=>
float(-78.524277)
}
[56]=>
array(4) {
["A"]=>
string(5) "Cairo"
["B"]=>
string(5) "Egypt"
["C"]=>
float(30.064742)
["D"]=>
float(31.249509)
}
[57]=>
array(4) {
["A"]=>
string(12) "San Salvador"
["B"]=>
string(11) "El Salvador"
["C"]=>
float(13.69)
["D"]=>
float(-89.190003)
}
[58]=>
array(4) {
["A"]=>
string(6) "Malabo"
["B"]=>
string(17) "Equatorial Guinea"
["C"]=>
float(3.75)
["D"]=>
float(8.783333)
}
[59]=>
array(4) {
["A"]=>
string(6) "Asmara"
["B"]=>
string(7) "Eritrea"
["C"]=>
float(15.33236)
["D"]=>
float(38.92617)
}
[60]=>
array(4) {
["A"]=>
string(7) "Tallinn"
["B"]=>
string(7) "Estonia"
["C"]=>
float(59.438862)
["D"]=>
float(24.754472)
}
[61]=>
array(4) {
["A"]=>
string(11) "Addis Ababa"
["B"]=>
string(8) "Ethiopia"
["C"]=>
float(9.022736)
["D"]=>
float(38.746799)
}
[62]=>
array(4) {
["A"]=>
string(7) "Stanley"
["B"]=>
string(16) "Falkland Islands"
["C"]=>
float(-51.700981)
["D"]=>
float(-57.84919)
}
[63]=>
array(4) {
["A"]=>
string(8) "Torshavn"
["B"]=>
string(13) "Faroe Islands"
["C"]=>
float(62.017707)
["D"]=>
float(-6.771879)
}
[64]=>
array(4) {
["A"]=>
string(4) "Suva"
["B"]=>
string(4) "Fiji"
["C"]=>
float(-18.1416)
["D"]=>
float(178.4419)
}
[65]=>
array(4) {
["A"]=>
string(8) "Helsinki"
["B"]=>
string(7) "Finland"
["C"]=>
float(60.169813)
["D"]=>
float(24.93824)
}
[66]=>
array(4) {
["A"]=>
string(5) "Paris"
["B"]=>
string(6) "France"
["C"]=>
float(48.856667)
["D"]=>
float(2.350987)
}
[67]=>
array(4) {
["A"]=>
string(7) "Cayenne"
["B"]=>
string(13) "French Guiana"
["C"]=>
float(4.9227)
["D"]=>
float(-52.3269)
}
[68]=>
array(4) {
["A"]=>
string(7) "Papeete"
["B"]=>
string(16) "French Polynesia"
["C"]=>
float(-17.535021)
["D"]=>
float(-149.569595)
}
[69]=>
array(4) {
["A"]=>
string(10) "Libreville"
["B"]=>
string(5) "Gabon"
["C"]=>
float(0.390841)
["D"]=>
float(9.453644)
}
[70]=>
array(4) {
["A"]=>
string(6) "Banjul"
["B"]=>
string(6) "Gambia"
["C"]=>
float(13.453056)
["D"]=>
float(-16.5775)
}
[71]=>
array(4) {
["A"]=>
string(8) "T'bilisi"
["B"]=>
string(7) "Georgia"
["C"]=>
float(41.716667)
["D"]=>
float(44.783333)
}
[72]=>
array(4) {
["A"]=>
string(6) "Berlin"
["B"]=>
string(7) "Germany"
["C"]=>
float(52.523405)
["D"]=>
float(13.4114)
}
[73]=>
array(4) {
["A"]=>
string(5) "Accra"
["B"]=>
string(5) "Ghana"
["C"]=>
float(5.555717)
["D"]=>
float(-0.196306)
}
[74]=>
array(4) {
["A"]=>
string(6) "Athens"
["B"]=>
string(6) "Greece"
["C"]=>
float(37.97918)
["D"]=>
float(23.716647)
}
[75]=>
array(4) {
["A"]=>
string(4) "Nuuk"
["B"]=>
string(9) "Greenland"
["C"]=>
float(64.18362)
["D"]=>
float(-51.721407)
}
[76]=>
array(4) {
["A"]=>
string(11) "Basse-Terre"
["B"]=>
string(10) "Guadeloupe"
["C"]=>
float(15.998503)
["D"]=>
float(-61.72202)
}
[77]=>
array(4) {
["A"]=>
string(9) "Guatemala"
["B"]=>
string(9) "Guatemala"
["C"]=>
float(14.641389)
["D"]=>
float(-90.513056)
}
[78]=>
array(4) {
["A"]=>
string(14) "St. Peter Port"
["B"]=>
string(8) "Guernsey"
["C"]=>
float(49.458858)
["D"]=>
float(-2.534752)
}
[79]=>
array(4) {
["A"]=>
string(7) "Conakry"
["B"]=>
string(6) "Guinea"
["C"]=>
float(9.537029)
["D"]=>
float(-13.67847)
}
[80]=>
array(4) {
["A"]=>
string(6) "Bissau"
["B"]=>
string(13) "Guinea-Bissau"
["C"]=>
float(11.866667)
["D"]=>
float(-15.6)
}
[81]=>
array(4) {
["A"]=>
string(10) "Georgetown"
["B"]=>
string(6) "Guyana"
["C"]=>
float(6.804611)
["D"]=>
float(-58.154831)
}
[82]=>
array(4) {
["A"]=>
string(14) "Port-au-Prince"
["B"]=>
string(5) "Haiti"
["C"]=>
float(18.539269)
["D"]=>
float(-72.336408)
}
[83]=>
array(4) {
["A"]=>
string(11) "Tegucigalpa"
["B"]=>
string(8) "Honduras"
["C"]=>
float(14.082054)
["D"]=>
float(-87.206285)
}
[84]=>
array(4) {
["A"]=>
string(8) "Budapest"
["B"]=>
string(7) "Hungary"
["C"]=>
float(47.498406)
["D"]=>
float(19.040758)
}
[85]=>
array(4) {
["A"]=>
string(9) "Reykjavik"
["B"]=>
string(7) "Iceland"
["C"]=>
float(64.135338)
["D"]=>
float(-21.89521)
}
[86]=>
array(4) {
["A"]=>
string(9) "New Delhi"
["B"]=>
string(5) "India"
["C"]=>
float(28.635308)
["D"]=>
float(77.22496)
}
[87]=>
array(4) {
["A"]=>
string(7) "Jakarta"
["B"]=>
string(9) "Indonesia"
["C"]=>
float(-6.211544)
["D"]=>
float(106.845172)
}
[88]=>
array(4) {
["A"]=>
string(6) "Tehran"
["B"]=>
string(4) "Iran"
["C"]=>
float(35.696216)
["D"]=>
float(51.422945)
}
[89]=>
array(4) {
["A"]=>
string(7) "Baghdad"
["B"]=>
string(4) "Iraq"
["C"]=>
float(33.3157)
["D"]=>
float(44.3922)
}
[90]=>
array(4) {
["A"]=>
string(6) "Dublin"
["B"]=>
string(7) "Ireland"
["C"]=>
float(53.344104)
["D"]=>
float(-6.267494)
}
[91]=>
array(4) {
["A"]=>
string(9) "Jerusalem"
["B"]=>
string(6) "Israel"
["C"]=>
float(31.7857)
["D"]=>
float(35.2007)
}
[92]=>
array(4) {
["A"]=>
string(4) "Rome"
["B"]=>
string(5) "Italy"
["C"]=>
float(41.895466)
["D"]=>
float(12.482324)
}
[93]=>
array(4) {
["A"]=>
string(8) "Kingston"
["B"]=>
string(7) "Jamaica"
["C"]=>
float(17.992731)
["D"]=>
float(-76.792009)
}
[94]=>
array(4) {
["A"]=>
string(10) "St. Helier"
["B"]=>
string(6) "Jersey"
["C"]=>
float(49.190278)
["D"]=>
float(-2.108611)
}
[95]=>
array(4) {
["A"]=>
string(5) "Amman"
["B"]=>
string(6) "Jordan"
["C"]=>
float(31.956578)
["D"]=>
float(35.945695)
}
[96]=>
array(4) {
["A"]=>
string(6) "Astana"
["B"]=>
string(10) "Kazakhstan"
["C"]=>
float(51.1)
["D"]=>
float(71.3)
}
[97]=>
array(4) {
["A"]=>
string(7) "Nairobi"
["B"]=>
string(5) "Kenya"
["C"]=>
float(-1.17)
["D"]=>
float(36.48)
}
[98]=>
array(4) {
["A"]=>
string(6) "Tarawa"
["B"]=>
string(8) "Kiribati"
["C"]=>
float(1.3)
["D"]=>
float(173)
}
[99]=>
array(4) {
["A"]=>
string(5) "Seoul"
["B"]=>
string(11) "South Korea"
["C"]=>
float(37.31)
["D"]=>
float(126.58)
}
[100]=>
array(4) {
["A"]=>
string(11) "Kuwait City"
["B"]=>
string(6) "Kuwait"
["C"]=>
float(29.3)
["D"]=>
float(48)
}
[101]=>
array(4) {
["A"]=>
string(7) "Bishkek"
["B"]=>
string(10) "Kyrgyzstan"
["C"]=>
float(42.54)
["D"]=>
float(74.46)
}
}
Worksheet #1 -> Country Data #2
array(1) {
[1]=>
array(1) {
["A"]=>
NULL
}
}
Worksheet #2 -> Country Data #3
array(1) {
[1]=>
array(1) {
["A"]=>
NULL
}
}