mercredi 28 novembre 2018

Javascript: Pull csv data from web and store in array

I am trying to develop a javascript that pulls csv data from an external website and store it in an array. The reason why I am need this to be in javascript is that I am using a chrome extension called Shortkeys that can execute javascript code. I want the script to get (csv) data from an API (url), look through the csv data and generate a string based on the csv data. So far I've been trying with the fetch function, but Im new to javascript. So far I've got, but I dont really know what Im doing:

const url = 'https://myAPIurl.com';

fetch(url)
.then(response => response.text())
.then(contents => console.log(contents))

Suggestions are greatly appreciated.

Thanks, Peter




Aucun commentaire:

Enregistrer un commentaire