[Tfug] Bulk OpenOffice Conversion

Jim Secan jim at nwra.com
Thu May 24 15:51:17 MST 2007

Customer wants *.xls-format files, would like to have nice formatting (I'd
like to have free beer, but one can't have everything).  Yes, cvs files
will work and are easy to build, but that's not what is needed.  I'm now
not sure that going through OO helps me, since I still have the OO-to-Excel
conversion to automate.

The more I look into this the non-easier it looks.  I had hoped I had a
python solution (pyUNO), but the closer I looked at that the more warts I
found, including the ever-present steep learning curve.  The perl solutions
look nice, but I'm not a "perlie" so I'd have to did out my
perl-for-dummies books and fiddle more than I'd like.  So, no free lunches
found, but lots of pieces that might be made into something.  Now, if
someone just had a nice Fortran solution that I could run from my C-shell
(flames ON!).

OK, truth-be-told, I was hoping for something really easy along the lines of:

cat asciiColumn.txt | openoffice --Calc --noGUI --TextIn --ExcelOut > xxx.xls

(Yes, I did try just typing this in - "openoffice: Command not found.")


At 03:25 PM 5/24/2007 -0700, you wrote:
>On May 24, 2007, at 7:45 am, Jim Secan wrote:
>> I need to convert a large number of ASCII data files (column  
>> format, space
>> delimited) to OO Calc format, and from there to Excel format
>Hm. Forgive me if I'm missing something, but from the information you  
>give, it sounds a pretty simple conversion.
>I don't think you mean that a single space is the delimiter, and the  
>columns aren't actually aligned:
>	cat file | sed -e 's/ /,/g' > file.csv
>Okay, so columns *are* aligned. I'll assume ten characters per column:
>	cat file | sed -e 's/\(..........\)/\1,/g' > file.csv
>Basically, after every ten characters, insert a comma in the eleventh- 
>of-ten position. Maybe pre-check for commas and replace them with a  
>placeholder character because escaping is going to mess with the  
>Alternatively, you could drum up something tasty with cut and awk.
>Again, apologies if I'm assuming this is as trivial as I'm suggesting.
>Tucson Free Unix Group - tfug at tfug.org
>Subscription Options:
| Jim Secan           | Northwest Research Assoc, Inc |
| (jim at nwra.com)      | 2455 E. Speedway, Suite 204   |
| (520) 319-7773      | Tucson, Arizona 85719         |

More information about the tfug mailing list