Connecting the final pieces and returning the csv data
function createcsv (schedule){
//Other needed strings
var subject = schedule[i].teamname + " " + schedule[i].tshirtcolor;
var description = "Game #" + schedule[i].game + " vs " + schedule[i].competitor;
var alldayevent = "False";
var location = "Corvallis Sports Park";
var pprivate = "True"
var newcsventry = subject + "," + startdate + "," + starttime + "," + enddate + "," + endtime + "," + alldayevent + "," + description + "," + location + "," + pprivate + "\r\n";
finalcsv += newcsventry;
}
return finalcsv
};
Next a variable is made called location which is simply a string, “Corvallis Sports Park”. Then pprivate is identified as true so that the event will show up on your calendar automatically as a private event. The last part of setting up the CSV file is to concatenate all of these parts, following the original example shown here on the Google Help Forum, and add it to the final list. Please note that the last bits added to this string is ‘\r\n’ to make sure that the ‘feed line’ and ‘cartridge return’ (read: hitting the enter button) occurs. Once the for loop has finished processing, it will return a long string called finalcsv.
Up Next Time: Issues and edits of code thus far