Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is there a way to batch export different columns to different csv files in excel on an OSX, I'm thinking something along the lines of possibly automator, applescript or bash. I've had a look play around with automator and so far no luck.

The best I have accomplished export the whole sheet, then use sed to strip out what I don't need, however this is terribly inefficient.

Also, is there a method, to batch import multiple csv files into columns.

Thanks in advance

&& sorry I didn't tag excel correctly it wouldn't allow me to create the excel:mac tag

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Export the whole sheet to CSV and use AWK to split it into different files. As a simple example, this awk script will write each column into a different file.

#!/usr/bin/awk -f
{ 
    for (i=1; i<=NF; i++)
        print $i >> "file" i ".csv";
}

This script is not too intelligent. You should also specify the field separator at the beginning, and also make sure existing files are overwritten.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.