Hi,
you can import multiple CSV files into image J using this macro:
//this script opens all Text images (.csv) in a folder and saves them as tiff32 images in the output directory
dir1 = getDirectory("Choose directory");
dir2 = getDirectory("Choose Destination Directory ");
list = getFileList(dir1);
run("Close All");
setBatchMode(true);
for (i=0; i<list.length; i++) {
file = dir1 + list[i];
run("Text Image... ", "open=&file");
}
run("Images to Stack", "use");
setBatchMode(false);
run("Stack to Images", "use");
setBatchMode(true);
imgArray = newArray(nImages);
for (i=0; i<nImages; i++) {
selectImage(i+1);
imgArray[i] = getImageID();
}
for (i=0; i< imgArray.length; i++) {
selectImage(imgArray[i]);
saveAs("TIFF", dir2+list[i]);
}
run("Close All");
If you want to combine multiple tab delimited txt files you can use R studio.
The following script imports all files in a folder “Data” on the Desktop and creates a column for each file in a new data frame but it is also easily possible to write one dataframe for each file.
setwd("~/Desktop/Data")
files <-list.files()
df <- list()
for (f in files) {
tempData = scan(f)
df[[f]] <- tempData
}
Sample <- as.data.frame(df)
If you want to create an excel file with one sheet for each file it is possible to create a list containing all open dataframes and write this list to excel using writexl package:
samplelist <- setNames(lapply(ls(), function(x) if (class(get(x)) == "data.frame") get(x)), ls())