Search The Inn

Wednesday, January 4, 2023

Exporting a JMRI Roster to a CSV File

Quite a few people have asked the author if it is possible to export their roster to a CSV file so they can import it into a spreadsheet and if so how do they do it? Each one has their own reason for doing this but almost always insurance purposes is the main reason and that is alright but one important thing is missing from the CSV file, a picture of the locomotives(s) along with the purchase price and date purchased. Insurance representatives will want that. Pictures could be added to the file after importing into Excel but it is a LOT of work (depending on the number of locomotives involved). How long ago did I purchase that engine?? What did I pay for it (remember the insurance representatives)?? So, for insurance, the author feels JMRI itself is the best method. We will discuss adding columns to your roster soon in a future post.

Fortunately, thanks to one of the JMRI developers, Matthew Harris, it is now possible to easily export your roster to a CSV file. Open Decoder Pro. From the roster screen open the Actions Menu and at the bottom of the list select Run Script. See figure 1.

Figure 1 Run Script selection

This will present you with a window containing the Jython scripts included with your JMRI installation. Select RosterCsvExport.py and select Open. See figure 2.

Figure 2 Selecting RosterCsvExport.py

You will then be presented with a location for the generated file. Select the location you want and the name of the file. By default it will be saved to the same directory your roster is located in and named roster.csv. See figure 3.

Figure 3 Name of generated file and location to save to

Click Save and in few seconds the file will be generated. You can now import it into Excel or whichever spreadsheet you have.

Unfortunately, if you would like different information in your CSV file you will have to modify the script or have someone do it for you.


If you have an idea for a blog post here, let me know. If I can comment on it, I will or I'll see if someone else can and post it

No comments:

Post a Comment