How to export as tab delimited in excel or text edit

Here is my script. What I want to do is to export the fields as tab delimted and save it either in text edit (preferred) or excel

set Ret to {ASCII character 13, ASCII character 10, (ASCII character 10) & (ASCII character 13)}
set Mat to {"Wood: ", "Chain Link: ", "Steel: ", "Aluminum: ", "Vinyl: ", "Other: "}
set fld to {"First: ", "Last: ", "street: ", "City: ", "State: ", "Zip: ", "phone: ", "Matl: ", "Project Details: ", "contact: ", "referred by: "}

tell application “Mail”
set theMessages to selection
repeat with eachMessage in theMessages
set msg to content of eachMessage

   -- Get form of return
   repeat with aR in Ret
       if msg contains contents of aR then set rtn to contents of aR
   end repeat
   -- Figure out the Material (Matl)
   repeat with aMatl in Mat
       if msg contains contents of aMatl then set item 8 of fld to contents of aMatl
   end repeat
   -- now grab the parts
   set tid to AppleScript's text item delimiters
   set msgParts to {}
   repeat with k from 1 to count fld
       set AppleScript's text item delimiters to (fld's item k)
       set temp to (last text item of msg)
       set AppleScript's text item delimiters to rtn
       set end of msgParts to first text item of temp
       set AppleScript's text item delimiters to tid
   end repeat
   if item 8 of msgParts is "on" then set item 8 of msgParts to item 8 of fld & "on"

end repeat
end tell

– now have a list of the parts:
–set the colw to column width of range “B:B”
tell application “Microsoft Excel”
make new document
set horizontal alignment of range “B:B” to horizontal align right
set column width of range “A:A” to 15
set column width of range “B:B” to 20

end tell
repeat with i from 1 to number of items in fld

tell application “Microsoft Excel”

   set value of cell ("$A$" & i as string) to item i of fld
   set value of cell ("$B$" & i as string) to item i of msgParts

end tell
end repeat

If you have the data and just want to make a tab delimited file you don’t need TextEdit or Excel to do it. Just use AS’s built in file writing functions.

set textLists to {{"hello", "how", "are", "you?"}, {"I'm", "fine", "thank", "you."}}

set deskPath to path to desktop as Unicode text
set newfilePath to deskPath & "thefile.txt"
set fileRef to (open for access file newfilePath with write permission)

repeat with aTxtList in textLists
	set writeLine to ""
	repeat with aTxtItem in aTxtList
		set writeLine to writeLine & aTxtItem & tab
	end repeat
	write writeLine & return to fileRef
end repeat

close access fileRef