First, I should say that this code was ok last wee (that means it was running and no problems).
I don't know why, but: 1 - I have a Excel file on OneDrive. This file have the xlwings imported and this function on VBA:
Sub CallSAP()
'Run the Python Script
RunPython ("import LoadSAP; LoadSAP.ScriptSAP()")
End Sub
2 - The LoadSAP.py was placed on the same path of the Excel file.
This week, I have the issue:
---------------------------
Error
---------------------------
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'LoadSAP'
Press Ctrl+C to copy this message to the clipboard.
---------------------------
OK
---------------------------
It's similar to xlwings module.py call python from excel
3 - So, I tried to execute the LoadSAP.py, I maked a copy on the C://Documents, I runned the function on Jupyter notebook file, and miraculously the Excel now recognize the LoadSAP. Ps.: I need to know how to fix this issue because I have the same to the loadMaps.py function.
4 - Now, running on the Excel, a new problem appears: the program doesn't recognize the path of OneDrive, and it suggest to change to the link https.
OSError: [WinError 123] The syntax of the file name, directory name, or volume label is incorrect: 'https://.../Documents/.../Excel file.xlsm'
5 - After I did the change like demanded on item 4, on this line code (this read na other Excel file to push some data)
gerder = read_excel(path_gerder + file_gerder, sheet_name='Base')
I have 2 issues:
Sometimes it returns:
'ascii' codec can't encode character '\xea' in position 56: ordinal not in range(128)
Sometimes it returns:
No such file: 'https://.../Documents/.../gerder file.xls'
Ps.: If I use the link to the file on the brownser, it's downloaded.
I have many singulars issues and it worked well just one week ago: the Excel recognized all the *.py, the program readed all the Excel file directly of OneDrive, etcs etcs. So if you have any idea or suggestion, I open to try.