Last active
March 20, 2018 01:01
-
-
Save leandrojo/fdff8dfb266e0f86b24cd53928fe9386 to your computer and use it in GitHub Desktop.
Ler CSV e transforma em um array.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| window.onload = function() { | |
| var fileInput = document.getElementById('fileInput'); | |
| var fileDisplayArea = document.getElementById('fileDisplayArea'); | |
| fileInput.addEventListener('change', function(e) { | |
| var file = fileInput.files[0]; | |
| var textType = /csv.*/; | |
| if (file.type.match(textType)) { | |
| var reader = new FileReader(); | |
| reader.onload = function(e) { | |
| var rows = []; | |
| var keys = []; | |
| reader.result.split(/\n/).map(function (row, i) { | |
| if (i === 0) return keys.push(row.split(/,/)); | |
| return rows.push(row.split(/,/)); | |
| }); | |
| console.log(rows); | |
| console.log(keys); | |
| fileDisplayArea.innerText = reader.result; | |
| } | |
| reader.readAsText(file); | |
| } else { | |
| fileDisplayArea.innerText = "File not supported!" | |
| } | |
| }); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| date | bucket | count | |
|---|---|---|---|
| 2012-07-20 | 800 | 119 | |
| 2012-07-20 | 900 | 123 | |
| 2012-07-20 | 1000 | 173 | |
| 2012-07-20 | 1100 | 226 | |
| 2012-07-20 | 1200 | 284 | |
| 2012-07-20 | 1300 | 257 | |
| 2012-07-20 | 1400 | 268 | |
| 2012-07-20 | 1500 | 244 | |
| 2012-07-20 | 1600 | 191 | |
| 2012-07-20 | 1700 | 204 | |
| 2012-07-20 | 1800 | 187 | |
| 2012-07-20 | 1900 | 177 | |
| 2012-07-20 | 2000 | 164 | |
| 2012-07-20 | 2100 | 125 | |
| 2012-07-20 | 2200 | 140 | |
| 2012-07-20 | 2300 | 109 | |
| 2012-07-20 | 2400 | 103 | |
| 2012-07-21 | 800 | 123 | |
| 2012-07-21 | 900 | 165 | |
| 2012-07-21 | 1000 | 237 | |
| 2012-07-21 | 1100 | 278 | |
| 2012-07-21 | 1200 | 338 | |
| 2012-07-21 | 1300 | 306 | |
| 2012-07-21 | 1400 | 316 | |
| 2012-07-21 | 1500 | 269 | |
| 2012-07-21 | 1600 | 271 | |
| 2012-07-21 | 1700 | 241 | |
| 2012-07-21 | 1800 | 188 | |
| 2012-07-21 | 1900 | 174 | |
| 2012-07-21 | 2000 | 158 | |
| 2012-07-21 | 2100 | 153 | |
| 2012-07-21 | 2200 | 132 | |
| 2012-07-22 | 900 | 154 | |
| 2012-07-22 | 1000 | 241 | |
| 2012-07-22 | 1100 | 246 | |
| 2012-07-22 | 1200 | 300 | |
| 2012-07-22 | 1300 | 305 | |
| 2012-07-22 | 1400 | 301 | |
| 2012-07-22 | 1500 | 292 | |
| 2012-07-22 | 1600 | 253 | |
| 2012-07-22 | 1700 | 251 | |
| 2012-07-22 | 1800 | 214 | |
| 2012-07-22 | 1900 | 189 | |
| 2012-07-22 | 2000 | 179 | |
| 2012-07-22 | 2100 | 159 | |
| 2012-07-22 | 2200 | 161 | |
| 2012-07-22 | 2300 | 144 | |
| 2012-07-22 | 2400 | 139 | |
| 2012-07-22 | 2500 | 132 | |
| 2012-07-22 | 2600 | 136 | |
| 2012-07-22 | 2800 | 105 | |
| 2012-07-23 | 800 | 120 | |
| 2012-07-23 | 900 | 156 | |
| 2012-07-23 | 1000 | 209 | |
| 2012-07-23 | 1100 | 267 | |
| 2012-07-23 | 1200 | 299 | |
| 2012-07-23 | 1300 | 316 | |
| 2012-07-23 | 1400 | 318 | |
| 2012-07-23 | 1500 | 307 | |
| 2012-07-23 | 1600 | 295 | |
| 2012-07-23 | 1700 | 273 | |
| 2012-07-23 | 1800 | 283 | |
| 2012-07-23 | 1900 | 229 | |
| 2012-07-23 | 2000 | 192 | |
| 2012-07-23 | 2100 | 193 | |
| 2012-07-23 | 2200 | 170 | |
| 2012-07-23 | 2300 | 164 | |
| 2012-07-23 | 2400 | 154 | |
| 2012-07-23 | 2500 | 138 | |
| 2012-07-23 | 2600 | 101 | |
| 2012-07-23 | 2700 | 115 | |
| 2012-07-23 | 2800 | 103 | |
| 2012-07-24 | 800 | 105 | |
| 2012-07-24 | 900 | 156 | |
| 2012-07-24 | 1000 | 220 | |
| 2012-07-24 | 1100 | 255 | |
| 2012-07-24 | 1200 | 308 | |
| 2012-07-24 | 1300 | 338 | |
| 2012-07-24 | 1400 | 318 | |
| 2012-07-24 | 1500 | 255 | |
| 2012-07-24 | 1600 | 278 | |
| 2012-07-24 | 1700 | 260 | |
| 2012-07-24 | 1800 | 235 | |
| 2012-07-24 | 1900 | 230 | |
| 2012-07-24 | 2000 | 185 | |
| 2012-07-24 | 2100 | 145 | |
| 2012-07-24 | 2200 | 147 | |
| 2012-07-24 | 2300 | 157 | |
| 2012-07-24 | 2400 | 109 | |
| 2012-07-25 | 800 | 104 | |
| 2012-07-25 | 900 | 191 | |
| 2012-07-25 | 1000 | 201 | |
| 2012-07-25 | 1100 | 238 | |
| 2012-07-25 | 1200 | 223 | |
| 2012-07-25 | 1300 | 229 | |
| 2012-07-25 | 1400 | 286 | |
| 2012-07-25 | 1500 | 256 | |
| 2012-07-25 | 1600 | 240 | |
| 2012-07-25 | 1700 | 233 | |
| 2012-07-25 | 1800 | 202 | |
| 2012-07-25 | 1900 | 180 | |
| 2012-07-25 | 2000 | 184 | |
| 2012-07-25 | 2100 | 161 | |
| 2012-07-25 | 2200 | 125 | |
| 2012-07-25 | 2300 | 110 | |
| 2012-07-25 | 2400 | 101 | |
| 2012-07-26 | 1300 | 132 | |
| 2012-07-26 | 1400 | 117 | |
| 2012-07-26 | 1500 | 124 | |
| 2012-07-26 | 1600 | 154 | |
| 2012-07-26 | 1700 | 167 | |
| 2012-07-26 | 1800 | 137 | |
| 2012-07-26 | 1900 | 169 | |
| 2012-07-26 | 2000 | 175 | |
| 2012-07-26 | 2100 | 168 | |
| 2012-07-26 | 2200 | 188 | |
| 2012-07-26 | 2300 | 137 | |
| 2012-07-26 | 2400 | 173 | |
| 2012-07-26 | 2500 | 164 | |
| 2012-07-26 | 2600 | 167 | |
| 2012-07-26 | 2700 | 115 | |
| 2012-07-26 | 2800 | 116 | |
| 2012-07-26 | 2900 | 118 | |
| 2012-07-26 | 3000 | 125 | |
| 2012-07-26 | 3200 | 104 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment