Client generated the attached python code but it does not seem to be working. Kindly seek your help to check and advise.
Thank you
@shaun.soh
Thank you for reaching out to us.
The code does not use our LSEG Data Libraries and it uses the win32com.client library to open Excel files.
As far as I know, the client cannot use Python code to open or retrieve data from a Workspace Excel file.
There is a 3rd party library name xlwings that lets developers use a Python code to interact with the Excel file (including sends data from Python to Excel). The library works fine with LSEG Python APIs.
The client can find the LSEG APIs with xlwings resources from the following aritcles:
Hi @Jirapongse
Thank you for the prompt assistance. The client wants to know if win32.com.client library is the only issue? Could there be other potential issues that prevents it from working?
Kind regards,
Shaun
Typically, the issue occurs because the Workspace Excel add-in does not load properly when Excel is started through a script.
Therefore, we recommend using LSEG Data Libraries (Python, TypeScript, or .NET) to pull data instead.
Hi Jirapongse,
Thanks for your revert. The reason for starting Excel via a script is because i hv an excel template with Refinitiv formula built in. What i want to do is to automate this existing template by feeding ISINs (saved in a separate excel file) into this Excel file with Refinitiv formula and then take a screenshot of the output. Do you have another way of doing this? thanks
@PMG
We recommend using LSEG Data Libraries (Python, TypeScript, or .NET) to pull data instead. The Python library can also use with the Xlwings library to manage Excel files.
Thanks. Tried to import xlwings but got the ModuleNotFound error msg. Then when i tried to install xlwings, got the error msg saying Disabled…can you advise how to install xlwings in Codebook please? Refer to attached.
Unable to attach the screenshots here…
Codebook does not support the installation of additional Python libraries. Only the libraries pre-installed in Codebook are available for use.
You may need to set your local Notebook environment on your machine.
Noted. So that means i hv to install my own python editor and also install the libraries on my machine?
Sorry but i dont understand your comment above - There is a 3rd party library name xlwings that lets developers use a Python code to interact with the Excel file (including sends data from Python to Excel). The library works fine with LSEG Python APIs.
Thought Codebook has xlwings installed..
I couldn't find xlwings in the Codebook.
You may check other Excel libraries in Codebook.
In addition, Codebook includes charting libraries such as Plotly and Bokeh, which can be used to create data visualizations.