Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save ivanlawrence/5edd8a5fc49c10f7a7f6573f9607b4a1 to your computer and use it in GitHub Desktop.

Select an option

Save ivanlawrence/5edd8a5fc49c10f7a7f6573f9607b4a1 to your computer and use it in GitHub Desktop.
Magic Formula Investing - download - bookmarklet
javascript:(function(){
let csv = []
// loop through each row
$('#tableform').find('tr').each(function() {
let row = [];
// loop through each cell in a row
$(this).find('th,td').each(function() {
// add to the row array
row.push( '"' + $(this).text().trim() + '"' );
});
// add a row to the CSV
csv.push( row.join(',') );
});
// flatten the CSV
let csvText = csv.join('\r\n')
let dl = document.createElement("a");
dl.href = "data:text/csv;charset=utf-8,"+ encodeURI( csvText );
dl.download = "magicFormulaInvesting.csv";
document.body.appendChild(dl);
dl.click();
document.body.removeChild(dl);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment