Parse .csv files with applescript

Hello,
What I am trying to do:
I am a college student and am somewhat new to applescript. My problem is that different profs give me important dates for their courses through different mediums such as: internet, excel, and on paper. It is easy for me to bring all the dates into an excel file and save it as .csv. I have around 150 of these dates that i need to put into entourage as calendar events. It would save me a great deal of time if i could write a script that would create calendar events from from the .csv file rather than manually creating 150 calendar events.

What i know:
I found some scripts that came with entourage that let me create a calendar event. So i can create a calendar event with applescript.

Where my problem right now is:
Right now i need to parse a .csv file which contains 3 values per line for example:

Jan 4, Topic 1: the cell, 8:30
Jan 8, Topic 2: microorganisms , 11:00
Jan 11,Topic 3: mitochondria , 9:30

I have no idea how to do this, any help would be greatly appreciated. (my system information is located below)

Model: MacBook Pro
AppleScript: 1.10.7
Browser: Firefox 1.5.0.9
Operating System: Mac OS X (10.4)

This can get you started:

set csvData to "Jan 4, Topic 1: the cell, 8:30
Jan 8, Topic 2: microorganisms , 11:00
Jan 11,Topic 3: mitochondria , 9:30"

--> or:
-- set csvData to read file "path:to:file.csv"

set csvEntries to paragraphs of csvData

repeat with i from 1 to count csvEntries
	set {theDate, theTopic, theTime} to parseCsvEntry(csvEntries's item i)
	--> now, pass the parsed data to Entourage calendar event
	--> if you need a valid date, just:
	-- set fullDate to date (theDate & space & "2007" & space & theTime)
end repeat


to parseCsvEntry(csvEntry)
	set AppleScript's text item delimiters to ","
	set {theDate, theTopic, theTime} to csvEntry's text items
	set AppleScript's text item delimiters to {""}
	return {theDate, theTopic, theTime}
end parseCsvEntry

jj’s advice will get you started if the CSV file is very straight-forward but if it is just any CSV that follows the standard, it can be quite complex. Search on CSV in the Applescript Users applescript-users@lists.apple.com list and you’ll get 40 or 50 hits in one thread discussing some of the difficulties.

Hi dankj,

Also, you can learn to use Excel to import csv data. Within Excel, you can format the date field to date and time field to time. When you have everything done, you can create events in Entourage straight from the data.

gl,