Hi Martin
I've done something like that before for CSV data in this macro:
http://doube.org/files/Umis_Array0.53.txtThe sections of interest are these:
//Open the array file which must be a csv list like x,y,f
string = File.openAsString("");
//Split the CSV file into an array of lines
lines = split(string, "\n");
nindents = lengthOf(lines);
Then I split each line at the commas like:
data = split(lines[n], "\,");
so data[x] holds the data sitting at row n and column x
This function uses the above method:
function parse_moduli() {
//parse the moduli file
modulus_min = 99999999;
modulus_max = 0;
moduli_file = File.openAsString("");
moduli_lines = split(moduli_file, "\n");
moduli = newArray(nindents);
for (m=0; m<lengthOf(moduli_lines); m++){
moduli_n= split(moduli_lines[m], "\,");
if (isNaN(moduli_n[1]) == true) moduli[m] = 0; else moduli[m] =
parseFloat(moduli_n[1]);
if (moduli[m] < modulus_min) modulus_min = moduli[m];
if (moduli[m] > modulus_max) modulus_max = moduli[m];
}
}
Hopefully that's enough to get you started
Mike
Quoting Martin Jaekel <
[hidden email]>:
> Hi,
>
> I would like to import a column of numeric values from excel (or from a txt
> file) into my macro.
>
> Can anybody help?
>
> Thanks,
> Martin
>