# Is there an "Iron Python" compatible "API Access Library" for Calc?

The "scripting language" (WizoScript) for my CAD system is written in "Iron Python." The only access to spreadsheets in it are "Excel xlsx" format. I vastly prefer (Libre Office) Calc, and would prefer to NOT attempt to "translate" everything to be "xlsx compatible." Not having been a "programmer" for more than 30 years, I am dependent on the guy who wrote "WizoScript" for such utilities.

What I need (specifically) is the ability to "open" a Calc spreadsheet, access worksheets and cells within the spreadsheet (i.e. read and write values), and save & close a spreadsheet. I am told that such a "library" needs to be written in native (Iron) Python code.

edit retag close merge delete

If you can export as CSV or TSV, it can be used in Calc, but manipulating the data outside of Calc by using scripting might be a problem. However, if all the CAD does is write cells with nothing fancy, Calc should have good enough support for that, read and write. Otherwise, if you can publish the file, it can be used to figure out how to improve the support.

( 2016-10-28 22:25:05 +0200 )edit

More Detail: One "application" is a Calc spreadsheet used to generate "values" for a "chain-drive sprocket." There are five different TYPES of such "sprockets." So, in "basis design.D8" is an "identity" that allows me to determine WHICH type of "sprocket" is being laid out. Then, other "values" are located on different "worksheets" depending on WHICH type of "sprocket" is being laid out.

Such "one choice drives data selection" conditions are common in my applications.

( 2016-10-29 22:26:19 +0200 )edit

Sort by » oldest newest most voted

If Iron Python supports COM objects then you might try that for access to a calc spreadsheet.

how-to-protect-worksheet-using-com-objectalthough written in VB.net should help see how to use the COM objects.

Edit: I should add that if Iron Python is a 32 bit application then you need to use 32 bit version of LibreOffice. If Iron Python is 64 bit you need 64 bit LibreOffice.

more

Mark -- Thanks for replying. (1) I am (at best) a barely competent neophyte when it comes to Python (I was moderately competent in Forth, BCPL, & C back in the Dark Ages). The guy who wrote "WizoScript" is (at least to MY eyes) a competent Python programmer. He uses "openpyxl(.py)" to access "xlsx" format spreadsheets. I am, almost certainly, looking for some equivalent to "openpyxl" -- but written for Calc. Pointers and links greatly appreciated.

( 2016-10-28 22:24:00 +0200 )edit

@Lew_Merrick: https://openpyxl.readthedocs.io/en/de... is the home for that script. I'm pretty sure you can write same Python code with it that runs in IronPython and CPython.

( 2016-10-28 22:29:05 +0200 )edit

The openpyxl library is all I have at this time. I want to access ".ods" formatted files and not "convert" them to ".xlsx" format. I prefer to keep everything in "native" ".ods" format.

( 2016-10-31 18:55:51 +0200 )edit

Giving it a shot ...

Okey, so, if I understand you correctly, you need an IronPython-compatible script for the dev of WizoScript to read your OpenDocument Format Spreadsheets. That's pretty easy: https://wiki.openoffice.org/wiki/AODL seems like a good option.

Since IronPython can read DLL files for additional functionality, he needs to import that lib and call its functions with his IronPython programming.

(opendocument spreadsheet OR ods) c#, opendocument c#revealed other possible libs such as http://opendocumentformat.org/develop... and http://www.codeproject.com/Articles/3...

Alternative: save your ODS as FODS. There are some differences:

1) XML reader can be used, but one needs to know the specs of the format to manipulate the file, so it most likely ain't possible.

2) FO* files are pure XML text instead of the typical formats being in a more special ZIP package as multiple files. Thus these files tend to be large.

3) FO* files can't be protected with a password. A pw essentially encrypts the ZIP's contents, which can't be done with these flat files without a format change. This limitation can be bypassed by using, preferably, 7-Zip's own 7z format with Ultra compression, 64MB dictionary size (this is the highest value you can use on 32-bit computer. In other words, you may improve the compression ratio, but you make it impossible for non-64-bit computers to decompress the file if you make this any higher), highest word size, set to be completely solid and a password.

more

Rautamiekka -- I am sorry that I do not understand your suggestions. I am horribly out of date (nearly 30 years) in programming and I failed to understand your answer. (1) I am not sure what I would need to download to access the "AODL." (2) I feel like it's 1972 and I am being a PITA to Ward Christiansen and Irv Hoff as I tried to get my first MODEM operating. I am "caught" between ignorance and lack of understanding.

( 2016-11-04 17:51:31 +0200 )edit

@Lew_Merrick: it's better for him to use an IronPython-usable library to read your ODS.

( 2016-11-05 09:08:34 +0200 )edit