Hongyi Zhao <hongyi.z...@gmail.com> writes: > On Wed, Dec 30, 2020 at 1:55 AM Robert Thorpe > <r...@robertthorpeconsulting.com> wrote: >> >> Hongyi Zhao <hongyi.z...@gmail.com> writes: >> >> > On Tue, Dec 29, 2020 at 5:40 PM Jean Louis <bugs@gnu.support> wrote: >> >> >> >> * Hongyi Zhao <hongyi.z...@gmail.com> [2020-12-29 07:55]: >> >> > From this point of view, if we want to have both full-features and >> >> > powerful capabilities in manipulating spreadsheet, it seems that only >> >> > the python based programmatic tools/packages, say, openpyxl >> >> > <https://openpyxl.readthedocs.io>, can meet the requirements >> >> > currently. >> >> >> >> What are you requirements? >> > >> > I use Linux as my working environment exclusively. So, I can't access >> > the native MS Office supplied for macOS/Windows. But I sometimes >> > really need to manipulate and process MS Office documents, especially >> > DOCX and XLSX files. Though there are some free and open source office >> > suites, e.g. LibreOffice, but none of them can completely compatible >> > with the MS Office. >> > >> > So, I want to find a way that can be used to programmatically complete >> > any possible work done by MS Office word/excel. >> >> Who creates the spreadsheet first? Is it you or someone else? > > From/by others, in most instances. > >> >> If it's you then things can be quite simple. You can create a >> comma-separated or tab-separated file in Emacs or something else. > > Do you mean export the org table with CSV/TSV formats? I noticed that the > default orgmode table column separator is |.
I was thinking of editing using csv-mode, not using orgmode table. But if you have well behaved data it's not hard to change the separate with a search-and-replace. You've got to watch out for corner cases though like commas being used in text. >> You can then import that file into Libreoffice and then save it as a .XLSX >> or .XLS file. You can make a script in Libreoffice to do the import >> just the way you want it. > > Sounds wonderful. Is there such an example script? Last time I did this a few years ago at work. I don't have the code anymore. You can find a few things like that at the Libreoffice extensions site though https://extensions.libreoffice.org/ . >> Things are more difficult if you are given a .XLSX or .DOCX file by >> someone else. In that case you have to use Libreoffice or something >> like it straight away. You also have to be very careful was re-saving >> the file with changes because Libreoffice has some subtle >> incompatabilities with MS Excel and MS Word. >> >> If you just want to add new sheets to existing spreadsheets that is not >> too bad. The problem is changing values in existing sheets. > > You're absolutely right. BR, Robert Thorpe