Libreoffice doesn't recognice the installed openpyxl module

With your help I created a Libreoffice python-makro which runs perfect in Ubuntu20.04.
Some users need my macro in Windows10. So I installed (in my Windows dual boot) LibreOffice Community Version 7.1.5.2 and via pip the required openpyxl module.

repeating the command

py -3.8 -m pip install openpyxl

I get:

Requirement already satisfied: openpyxl in c:…\appdata\local\programs\python\python38\lib\site-packages (3.0.8)
Requirement already satisfied: et-xmlfile in c:…\appdata\local\programs\python\python38\lib\site-packages (from openpyxl) (1.1.0)

But when I start the macro via Llibreoffice → macros–> python -->macroname
I get an error saying:

…(<class ‘ImportError’>: No module named ‘openpyxl’ (or ‘openpyxl.load_workbook’ is unknown)…

any idea how to get the macro running in windows10

Try to append the path, insert above import openpyxl:

import sys
sys.path.append("c:…/appdata/local/programs/python/python38/lib/site-packages (3.0.8)")
…

why do you want to use openpyxl from inside LO?
LO itself have the capbilities to read|write Excel-files

I’ve tried to append the path without success.
I can’t use the LO model because I didn’t check how to install the uno bridge in pycharm (though I tried it 2 days long). Furthermore I think openpyxl is more pythoniastic.

I use openpyxl to do the grunt work and load it back into calc for the user interface.

With Linux there is python preinstalled in the OS available, so LO is usually configured to use this.

Windows has no python so LO brings its own. Sadly this is no complete installation and it has no pip. If you install a “real” python, this is independent and not seen by LOs python.

So you can either copy your lib to the python in LO or try to install some PIP for this python.

You are not the first asking:

Third option: You may call an external python via shell() like any external program and tell the external python to run your .py-module.

see this topic: