SheetJS
f03e32fc9a
- frameworks: react, react-native, preact, next.js, weex, nuxt.js - deployments: nodejs server, duktape, chakra, electron, nw.js
10 行
443 B
JavaScript
10 行
443 B
JavaScript
/* xlsx.js (C) 2013-present SheetJS -- http://sheetjs.com */
|
|
var XLSX = require('xlsx'), request = require('request');
|
|
var url = 'http://www.freddiemac.com/pmms/2017/historicalweeklydata.xls'
|
|
request(url, {encoding: null}, function(err, res, data) {
|
|
if(err || res.statusCode !== 200) return;
|
|
var wb = XLSX.read(data, {type:'buffer'});
|
|
var ws = wb.Sheets[wb.SheetNames[0]];
|
|
console.log(XLSX.utils.sheet_to_csv(ws, {blankrows:false}));
|
|
});
|