Skip to content

Instantly share code, notes, and snippets.

@dun4n
Created February 21, 2014 13:00
Show Gist options
  • Save dun4n/9133841 to your computer and use it in GitHub Desktop.
Save dun4n/9133841 to your computer and use it in GitHub Desktop.
Export #JavaScript Array as CSV
<!doctype html>
<html>
<head>
<script type="text/javascript">
var languages = [ // source: http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html
['Feb 2014', 'Feb 2013', 'Programming Language', 'Ratings', 'Change'],
[1, 2, 'C', '18.334%', '+1.25%'],
[2, 1, 'Java', '17.316%', '-1.07%'],
[3, 3, 'Objective-C', '11.341%', '+1.54%'],
[4, 4, 'C++', '6.892%', '-1.87%'],
[5, 5, 'C#', '6.450%', '-0.23%'],
[6, 6, 'PHP', '4.219%', '-0.85%'],
[7, 8, '(Visual) Basic', '2.759%', '-1.89%'],
[8, 7, 'Python', '2.157%', '-2.79%'],
[9, 11, 'JavaScript', '1.929%', '+0.51%'],
[10, 12, 'Visual Basic .NET', '1.798%', '+0.79%']
]
var b = new Blob([languages.join('\n')], {"type": "text/csv"})
document.location.href = URL.createObjectURL(b)
</script>
</head>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment