CSV to Tab conversion with RunRev

The csv to tab delimited conversion script, which I just posted on the Revolution Use List. I post it here just in case it is useful to someone. This script doesn’t take returns and tabs inside cells in consideration.

function csv2tab theData
    repeat for each line myLine in theData
         repeat for each word myWord in myLine
              if char 1 of myWord is quote and (char -2 of myWord is
               quote or char -1 of myWord is quote) then
                   replace comma with “<#>” in myWord
              end if
              put myWord after myNewData
         end repeat
         put cr after myNewData
    end repeat
    replace comma with tab in myNewData
    replace “<#>” with comma in myNewData
    return myNewData
end csv2tab

Leave a Reply

Your email address will not be published. Required fields are marked *