Parse CSV: Ignore First Line

Find out why the . goes before the /

Moderator: Paul Tuersley

Post Reply
sbaden
Posts: 35
Joined: June 16th, 2009, 1:07 pm
Location: Santa Clarita, CA

I have a script that prompts the user to select a CSV file. The script then parses the CSV into a table. I'm not sure how to tell it to ignore the first line of the table. Here is the script:

Code: Select all

var table = new Array();
var lines = encoded_data.split(/\r*\n/);
	
for (i = 0; i < lines.length; i++) {
     table[i] = lines[i].split(",");
}
Dan Ebberts
Posts: 320
Joined: June 26th, 2004, 10:01 am
Location: Folsom, CA
Contact:

Try this (not tested):

Code: Select all

for (i = 1; i < lines.length; i++) {
     table[i-1] = lines[i].split(",");
}

Dan
sbaden
Posts: 35
Joined: June 16th, 2009, 1:07 pm
Location: Santa Clarita, CA

Worked great Dan. Thank you... :D
Post Reply