Newbie question: importing spreadsheet

This simple script might work if the order of the columns is Subject, Date, Body and Category. Note: You have to select the sheet in the frontmost window.


tell application "DEVONthink Pro"
	set theSheet to content record of think window 1
	if type of theSheet is not sheet then error
	
	set theForms to children of theSheet
	repeat with theForm in theForms
		set theFields to cells of theForm
		set theSubject to item 1 of theFields
		set theBody to item 3 of theFields
		set theCategory to item 4 of theFields
		set theGroup to create location "/" & theCategory
		create record with {name:theSubject as string, type:txt, text:theBody as string} in theGroup
	end repeat
end tell