Command Line Questions

brianscottnole

New Member
Joined
Nov 6, 2009
Messages
4
Hello friends -

I've got a third party vendor application that creates spreadsheets really quite nicely. I've got a need to take some of those sheets, read them electronically, and spit the results back out somewhere else. I've successfully used the Apache POI APIs for this purpose in the past.

However, the spreadsheets that are created by the vendor application cause the POI component to fail when they try to open the workbook with a "DimensionsRecord was not found" error.

The tricky part is that if I manually open the spreadsheet, then save it without making any changes, my POI process has no problems and can read the file fine. I also notice that when I open the spreadsheet, then save it, it losses about half its size on the disk.

So, the entire undertaking is about making it so folks don't have to go and open a spreadsheet. A command line solution to open excel with a particular file doesn't seem to difficult, but what I really need to do is command line to open the file, then save it again, (hopefully) causing the mysterious conversion to take place that allows my automated process to manipulate the spreadsheet.

Any insight is appreciated.

- brian
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Bump. Bump. Bump. Can anyone help? Gurus? Someone please save me from having to communicate to some strange embedded database with proprietary ODBC drivers that can only be installed at the sewer treatment plant. Please!

brian
 
Upvote 0
Why not create an Excel Macro that opens the offending file, saves it, closes it, and exits the Excel application? If you add that macro code to the Workbook_Open event in Excel, it will be kicked off automatically when that Excel macro file is opened.

You could then use Scheduling software (like Windows Scheduler that comes with Windows) to open the Excel file at your specified date/times, so that the entire process is automated.
 
Upvote 0
Hi Joe -

Thank you for your response.

The spreadsheets in question are being generated by an external application, one each day; in other words, there is a brand new spreadsheet to be evaluated every day. Is there a way that I can pass through a macro to be run at workbook_open time as a parameter? My options as far as getting the vendor to change how they do things is very limited (or non existent).

brian
 
Upvote 0
I am not sure I understand. What do you want to send as the parameter?
 
Upvote 0
Hi Joe4 -

My apologies for being unclear.

My thought was, considering my target is a new spreadsheet that got created externally daily, it didn't seem like an option for me to alter the spreadsheet to have a macro defined for it at open_workbook time. It did occur to me, however, that it might be possible to submit a macro to be executed for this event via command line. That macro would be, at open time, just save back to the OS, at which point, I have libraries that can read the file.

Maybe my understanding of macros is invalid.

Thanks again for helping out.

brian
 
Upvote 0
I am not sure I follow your work flow or all the external processes that you are talking about, but the Excel macro would NOT be in the file you are wanted to open/save, it is its own separate file. Excel macros can be made to run on other Excel files.

If you open this Excel macro file via command line, you would, in essence, be running the macro with the command line (via Excel).
 
Upvote 0

Forum statistics

Threads
1,225,462
Messages
6,185,129
Members
453,279
Latest member
MelissaOsborne

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top