Created
March 22, 2017 09:58
-
-
Save dhunmoon/044d77571de15a32c198b85172b9d1c1 to your computer and use it in GitHub Desktop.
JS:SCV File Creation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var data = [["name1", "city1", "some other info"], ["name2", "city2", "more info"]]; | |
var csvContent = "data:text/csv;charset=utf-8,"; | |
data.forEach(function(infoArray, index){ | |
dataString = infoArray.join(","); | |
csvContent += index < data.length ? dataString+ "\n" : dataString; | |
}); | |
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