Read and Write Excel Download Help

Hi all!

I just had a quick question how to download and implement plugins into my macros; in this case, I am trying to use the “Read and Write Excel” plugin. I followed the instructions on:

But for some reason, when I update ImageJ, it does not eventually notify me that there are no more updates. In addition, I can’t seem to find the “Manage update sites” button, which would allow me to check mark the “Read and Write Excel” plugin, and I would really appreciate it if someone could show me how to download and implement this into my own code. Thanks so much in advance!

Hi @jchen ,

The installation instructions on the linked plugin page are more relevant to Fiji, than vanilla ImageJ. I would update the info but the page is hosted in a static format currently. If you are using Fiji, be careful to select ‘Help>Update…’ and not ‘Help>Update ImageJ…’.
If you are using vanilla ImageJ, then you may want to try the manual install as descibed in this post:

Kind regards

Hi Antinos!

This works perfectly, and I was able to get the plugin implemented into my code! I was also wondering if it was possible to manually write in and edit spreadsheets from ImageJ? For example, if at the end of each for loop, is it possible to add the value of a variable to the end of an existing excel spreadsheet? Thank you so much for your help!!

Hi @jchen ,
I’m glad it’s working for you and that I could help.
There are several ways to achieve, something at least close to, what you ask. However, this does go slightly beyond the design scope of this plugin or ImageJ, since neither claims to be a spreadsheet manager.

Despite the above disclaimer, one approach is to open the file as a results table in ImageJ. If the file is .xlsx then you may need to resave it as .csv. Once the data is loaded into an ImageJ table you can do whatever you like to it before exporting it back (replacing the old file or creating a new one). This option does not require the ‘Read and Write Excel’ plugin to open and manipulate the data (including adding ‘variables to the end’). You can optionally include the plugin to save the data to .xlsx format, even appending/updating the same output file, or just use the .csv save function of ImageJ if you don’t need to update the same file every time (there are ways to update the same file using the .csv save function as well which you can maybe work out by appreciating this answer altogether).
The above approach is not compatible with original files made up of multiple sheets or tabs.

Another approach depends somewhat on the regularity of layout of your files to be edited and upon whether you need to use the contents of the edited files to populate the new cells. The RaWE plugin has a little advertised function that allows an ImageJ results table to be inserted to a user specified location:

run("Read and Write Excel", "file=[C:/Users/antinos/Desktop/My_file.xlsx] sheet=banana cell_ref=[U69]");

So, you could create a custom table in ImageJ that contains only the value you wish to add to the end of your spreadsheet. So long as this table is named ‘Results’, then the plugin will export it to the specified file, sheet, and cell location. Of course, as I intimated at, this approach only really makes sense when applied iteratively if the files to be edited are of a known and repetitive layout (such that you know which cell references to feed to the plugin with a macro).
There are some good reasons to avoid using the ‘cell_ref=’ approach, including the fact that the plugin does not care what may already exist at the specified location when this function is called. Normally the plugin tries to append files without overwriting pre-existing data.

Another more mundane way to interpret your question(s) is ‘can I add a variable to the end of each of my data exports?’. I didn’t think this is what you meant, but the answer is yes. This is the most straightforward and conventional approach. The value/variable would simply be added to the end of the Results table prior to export.

Another easy answer to a fourth interpretation, is to use the ‘file=’ (maybe in conjunction with the ‘sheet=’) argument to specify each file you wish to update. This approach works best when you have separate files or data-sheets within the same file containing each set of data.

Writing all these out now, I realise that I don’t know enough about your actual request to suggest whether a reasonable solution is possible. If I haven’t already answered you, if you would like to give the exact requirement, with an example analysis pipeline, then I can try to make some time this weekend to look over your query.

Kind regards.

2 Likes

Hi Antinos!

Wow thank you for writing so much! But yes this definitely helps!

Thank you so much for your detailed and careful reply! I really appreciate all the help and time you have spent in answering my question!

Joseph

Great and useful information, thanks Antinos!