How can I bypass the import dialog when opening CSV with OpenOffice?

2

1

A (Python, but that's not really relevant) script I'm writing will issue a command line call to open a CSV file with OpenOffice (OO). I need OO to skip over the import dialog box while opening the script, or to tell OO that the defaults from that box are okay and thus the dialog is not needed.

Googling this has shown me stuff about setting up macros or a registered data source. Both of these seem to be overkill and are things I am clueless about.

Is there a command line option to tell OO to skip the dialog or use the defaults? Or some other simple way to accomplish what I need?

GreenMatt

Posted 2011-09-30T13:45:59.243

Reputation: 835

Answers

1

Perhaps if your Python script converted the CSV to another simple format (such as DIF) OpenOffice Calc would open it without needing a dialogue to confirm delimiters, column locations and column formats.

Update:

  • DIF doesn't work as OO asks what character encoding to use.
  • HTML doesn't work as OO asks what language to use.
  • SYLK works well

I used start run "D:\Apps\OpenOffice.org 3\program\scalc.exe" -calc d:\temp\table.slk to load this file

ID;P
C;Y1;X1;K"Row 1"
C;Y2;X1;K"Row 2"
C;Y3;X1;K"Total"
C;Y1;X2;K11
C;Y2;X2;K22
C;Y3;X2;K0;ER1C2+R2C2
E

With some effort your Python script can convert CSV files to temporary SYLK files on the fly.

RedGrittyBrick

Posted 2011-09-30T13:45:59.243

Reputation: 70 632

Interesting idea: In fact, I could just work in another format as long as it can be imported/exported easily by other programs. Unfortunately, as you said DIF format still gets a dialog; Flat XML (saved by OO as a .fods, but it can be renamed to a .xml) avoids the dialog, but increases the file size by over 100 times in a simple example. – GreenMatt – 2011-09-30T14:18:19.373

@GreenMatt: Answer updated - SYLK looks a good candidate. – RedGrittyBrick – 2011-09-30T14:48:44.313