Last active
August 29, 2015 14:05
-
-
Save RadGH/f30ca849f910a33e0060 to your computer and use it in GitHub Desktop.
Convert pasted Excel/Spreadsheet data to 2d array in JavaScript
This file contains 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
// Converts a (user-pasted) string to a 2d array, utilizing line breaks and tabs. | |
function interpret_table( data ) { | |
var table = data.split("\n"); | |
for (i in table) { | |
table[i] = table[i].split("\t"); | |
} | |
return table; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Looks basic, but it's quite useful. See this fiddle for usage:
http://jsfiddle.net/fobwoL8e/2/