Skip to content

Instantly share code, notes, and snippets.

@ZeccaLehn
Last active April 26, 2019 15:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ZeccaLehn/e586eb8f3ed5ad5cafc408af081c6cc0 to your computer and use it in GitHub Desktop.
Save ZeccaLehn/e586eb8f3ed5ad5cafc408af081c6cc0 to your computer and use it in GitHub Desktop.
CSV Download from document withing Javascript JS
var allDeals = document.getElementsByClassName('u-uncoloredLink js-syndicate_click');
var links = []
for (var i=0; i < allDeals.length; i++) {
links.push(allDeals[i].getAttribute('data-url'));
};
var csvContent = "data:text/csv;charset=utf-8,";
links.forEach(function(rowArray){
csvContent += rowArray + "\r\n";
});
var encodedUri = encodeURI(csvContent);
window.open(encodedUri);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment