mingsai

Numbers Read Tab Separated Values File Sub Routine

Feb 22nd, 2014
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. on readTabSeparatedValuesFile(thisTSVFile)
  2.     try
  3.         set dataBlob to (every paragraph of (read thisTSVFile))
  4.         set the tableData to {}
  5.         set AppleScript's text item delimiters to tab
  6.         repeat with i from 1 to the count of dataBlob
  7.             set the end of the tableData to (every text item of (item i of dataBlob))
  8.         end repeat
  9.         set AppleScript's text item delimiters to ""
  10.         return tableData
  11.     on error errorMessage number errorNumber
  12.         set AppleScript's text item delimiters to ""
  13.         error errorMessage number errorNumber
  14.     end try
  15. end readTabSeparatedValuesFile
Advertisement
Add Comment
Please, Sign In to add comment