View Full Version : automating project export

January 8th, 2010, 03:07 PM
Hi everyone -
I am relatively new to Monarch, and have a question that may seem basic, but here goes....

I have created a Project, and within that a Project Export. Does anyone know how I can get the PRJ to run the Export automatically? What is happening now, is that when I click the PRJ, the Model opens and takes me to the Table, but then I have to manually do File, Project Export to get it to run.

Thank you, in advance, for your assistance!


Data Kruncher
January 8th, 2010, 03:26 PM
Hi Deb. Welcome to the forum!

There aren't any settings to direct Monarch to run project exports automatically when a project is loaded, but you can still do what you want pretty easily.

The answer lies in creating a Windows batch file. You can direct windows to run Monarch and, via a mechanism known as "command line parameters", simultaneously open a project file and run your export(s). Run Notepad and type something like this:

"C:\Program Files\Monarch\Program\Monarch.exe" /prj:"C:\MyFolder\MyProject.xprj" /pxalland save the file to your desktop as "ProjectExport.bat".

Edit as necessary to indicate the proper path for the Monarch program and for your project file.

Now just double-click the batch file icon to execute the export.

For more information about automating Monarch via batch files, and to get a free tool that will build Monarch batch files for you by stepping you through the various options available to you, please visit ExcelWithMonarch.com (http://excelwithmonarch.com/tips/monarch-batch-file-generator).

If you're interested in gaining even better control of automating Monarch, you can subscribe to the Feedburner email service to receive ExcelWithMonarch.com site updates by email and you'll also receive a free tool that helps with programming Monarch via Excel.

Data Kruncher

February 22nd, 2010, 01:44 PM
I found this post which addresses my need also. However, when I created my bat file, it just launched the pgm and project, but did not export nor terminate. THEN, I noticed the scroll bar above and finally saw the /pxall parameter - BINGO, works like a champ!

February 26th, 2010, 12:54 PM
You can also specify which export to run by using the switch "/PX:<exportname>" in place of "/PXALL", where as <exportname> is the name of your export.

June 15th, 2010, 07:03 PM

I was reading through these posts and I'm looking to convert several files into excel on a daily basis. I have over 100 files that I convert into excel through monarch 6.0. Is the macro created in ExcelWithMonarch.com compatible with version 6.0?

Data Kruncher
June 15th, 2010, 09:17 PM
Welcome to the forum whathetin.

The command line rules for Monarch v6 (and earlier) are a little different from those of later versions, in that the available parameters are fewer, and they must appear in a specific order. For Monarch v7 and later, there are more possible parameters, and the order in which you use them doesn't matter.

For v6, you must use at least of these structures:

Monarch report_name model_nameor

Monarch project_namethen you can choose to follow one of those with any of these:


/R or /T or /S (to have your session open the Report, Table or Summary window)

/I to include the tree index if you're exporting to a portable report file (prf)

/M to include the model file if you're exporting to a portable report file (prf)

/D to, well, I can't find what /D does. :o Anybody?

/E to encrypt the file if you're exporting to a portable report file (prf)

Because the choices are pretty limited with v6, and because it was really developed to support later versions, I'd pass on using the Batch File Generator with it (but definitely use it for later Monarch versions!).

Then again, you could give it a try and just edit the resultant batch file yourself to strip out the unrecognized parameters like /rpt:, /mod: and /prj:.

June 18th, 2010, 01:55 PM
Thanks for your quick response. I am obviously very new to this and I don't know where to start with creating a command line. The Help Topic section wasn't very helpful. I have several projects created and I would like to automatically export these projects to excel. I access Monarch v6.0 remotely and do not have the application installed on my computer. Would this hinder me from creating a batch file?

Data Kruncher
June 18th, 2010, 03:04 PM
No, using Monarch remotely shouldn't be a problem for creating batch files, though you'll need to know the full path name of Monarch on the server.

You'll likely find it to be something like \\server\programs\Monarch\Program\Monarch.exe.

Then use

\\server\programs\Monarch\Program\Monarch.exe reportfile modelfile exportfile

If you have a large number of projects to process, then there may be better ways to do this kind of work, but this approach will fundamentally work.

August 2nd, 2010, 04:19 PM
Hi. I am trying to write a batch file that opens a project and exports to excel.

My batch file says:

I thought this would open the projects but its only opening the monarch application. I have version 6. What am I doing wrong?

August 2nd, 2010, 04:52 PM
Hello Whathetin,

Your batch file just relies on Windows to know what to do with a .prj file and that's why it opens it in Monarch. To tell Monarch to open the project and perform the exports, you'll need three bits of information, all in one line:

"C:\Program Files\Monarch\Program\Monarch.exe" "P:\APPS\MONARCH\PROGRAM\MONARCH\Projects-LA\GABV-PROJ.prj" /pxall

The first part tells Windows to run Monarch, the second tells Monarch to open the .prj file, and the third "/pxall" part tells Monarch to perform all the project exports defined in the project.

(edit) Just read the rest of the thread - to find out the path to the Monarch executable, you should right click on the shortcut to Monarch and look at the Properties. This should help you get the first of the three parts of the batch file right.

Best wishes,


August 12th, 2010, 01:02 PM
How do I define an export in a project?

Data Kruncher
August 12th, 2010, 01:11 PM
Click the Project Exports icon in the toolbar, and then step through the wizard after clicking the New button.

There are many options. More than can be summarized easily here.

For a further discussion on project exports, please see Easy Ways to Benefit from Automating Monarch (http://excelwithmonarch.com/tips/easy-ways-to-benefit-from-automating-monarch).

Of course you may post back here with further questions once you're under way if necessary.