function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
manjirimanjiri 

parsing CSV by column in apex

Hi,

 

I want to do CVS parsing. I got following link for parsing csv

http://wiki.developerforce.com/index.php/Code_Samples#Parse_a_CSV_with_APEX

 

But in my application i have requirement like I want to parse csv by columns.

i.e something like if file1 has col1, col2, col3, col4, col5

I want to make file2 with col1, col2, col3 from file1

(Similar to something as grep in unix)

So is there any way to do this in apex? Anybody tried this?

 

thanks,

Manjiri

 

bob_buzzardbob_buzzard

I'm not aware of any way to do this without parsing the file.

 

However, if you use the Wiki code to parse the CSV into a list (row) of list of strings (columns), you can then examine the contents and generate file 2 from this quite easily.