Exporting Data (Array) into selected cells in Excel

Hi,

In my project, I wrote a macro that would measure and store my results into an array. However, I want to save my array into an excel file that is already opened on my desktop on the active spreadsheet, starting at a selected cell and proceed saving it down the column. In Image-Pro, there is a macro/function that would do this, but I don’t see one on ImageJ/Fiji… unless I’m not looking hard enough. I tried looking at Read and Write Excel macro (https://imagej.net/User:ResultsToExcel), but I don’t think it will satisfy what I need. Does anyone have an approach to saving my array of data into excel with a certain function or other macros?

Thank you,

Jason

I am assuming you want to save the Results table. In the macro language you can write:

saveAs("Results", "/my/path/Results.csv");

and ImageJ will save the Results table to a .csv file. Excel can read that comma-delimeted .csv file and import the data. In case you (or someone reading this later) are European and prefer tab-delimited files, change the file extension above to .tsv and Fiji/ImageJ will use tabs as the delimiter.

Best regards,
John Minter

Hi John,

Thank you for your reply!

So what I have right now is that I have an excel file that is actively opened on my windows and I want to export directly from “results” to the active spreadsheet on the excel file at a specific cell.

Sounds like a job for VBA to import the .csv file…

John

@John_Minter

Hi John,

I resolved the problem thanks to your suggestion. I wrote a very small VBA code that would transfer my data from csv format to my desired excel file.

If anyone would like the VBA code to do so, feel free to message me.

Best Regards,

Jason

Glad it worked out. Please upload the VBA code you wrote to complete the example. The people who find this example in a search can download your exemplar and get started immediately. The ability for easily found “one stop shopping” is one of the great advantages of the Forum over the mailing list…