简体   繁体   中英

How can I convert an xls doc worksheet (from a workbook) to semicolon delimited csv (or txt or anything else) using Win7 native apps

I have been using both libreoffice and excel and I can run a vbs that opens excel invisibly and does this, but my company is going to move over to libreoffice. The issue with libreoffice, which is nice enough to have a built in converter, is that it does not separate sheets, as in, it only reads the front sheet. For single sheet workbooks I have been successful in using LO, but in multi-sheet xls or even ods, it is useless. I don't mind using java, powershell, command prompt, vbs, etc, I just want to use something that is more or less native to win7 and my company. I know java is not win7 native, but more or less everyone has it, so I count it in.

Sounds like you need to move from VBS that is "automating" the Excel application itself, to a small program that uses an Excel-reading library to parse the XLS files.

There's no such library "native" to Windows 7 in the sense that it ships with the stock OS. (Office doesn't either, for that matter.) But there are lots of libraries out there for it, including some that build on free redistributables from Microsoft. Sounds like C#/VB.Net or Java would both be good languages for you. There's probably even VBS bindings for some of this.

So go browsing for libraries. This is already covered in a lot of places, because tons of people want to extract data from Excel like this. Apache POI is a well-known one for Java, and you can find others browsing through similar SO or forum questions.

If you want to fully automate the process, you'll have better luck writing a program using a library like this instead of trying to script a desktop application with inadequate support.

Reading Excel files from C#

How to read and write excel file in java

You could even dig through the LibreOffice source code to see what library they're using for importing Excel. (Surely their full Calc program does a better job at importing Excel files than that converter utility.)

https://www.libreoffice.org/about-us/source-code/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM