我看着他們的API,但沒有任何成功與它。如何使用爸爸解析javascript csv解析
我想解析一些csv文件,當他進入服務器時發送到客戶端。
我試過這段代碼:
// Parse local CSV file
Papa.parse("data/premier league/14-15s.csv", {
complete: function(results) {
console.log("Finished:", results.data);
}
});
,沒有工作。它給出以下輸出:
Finished: [Array[1]]0: Array[1]0: "data/premier league/14-15s.csv"length: 1__proto__: Array[0]length: 1__proto__: Array[0]concat: function concat() { [native code] }constructor: function Array() { [native code] }entries: function entries() { [native code] }every: function every() { [native code] }filter: function filter() { [native code] }forEach: function forEach() { [native code] }indexOf: function indexOf() { [native code] }join: function join() { [native code] }keys: function keys() { [native code] }lastIndexOf: function lastIndexOf() { [native code] }length: 0map: function map() { [native code] }pop: function pop() { [native code] }push: function push() { [native code] }reduce: function reduce() { [native code] }reduceRight: function reduceRight() { [native code] }reverse: function reverse() { [native code] }shift: function shift() { [native code] }slice: function slice() { [native code] }some: function some() { [native code] }sort: function sort() { [native code] }splice: function splice() { [native code] }toLocaleString: function toLocaleString() { [native code] }toString: function toString() { [native code] }unshift: function unshift() { [native code] }Symbol(Symbol.iterator): function ArrayValues() { [native code] }Symbol(Symbol.unscopables): Object__proto__: Object
其中是csv?
我該如何創建一個具有該目錄的File對象? – user2810330
通過做我說的 - 創建一個類型文件的輸入元素。用戶必須選擇文件才能讓瀏覽器訪問它們。 – Matt
我是否應該將字符串更改爲? – user2810330