question

Upvotes
Accepted
3 0 0 3

[ Codebook - Excel] How to dynamically link ".xlsx" or ".csv" file generated in Codebook to Excel

Hello, I have an issue concerning the retrieval of data to an excel file.

1. I use the Refinitiv Date Library API in Python using Codebook.

2. I am trying to obtain data about numerous financial instruments (equity, stocks,...) concerning their performance indicator ("TR.TotalReturn") over a period of 5 years (until now) on a weekly basis.
My goal is to link the data that I get with my code to an Excel file updating whenever the financial data about the instruments change.

3. My uncomplete but actual code is this one below :
I use "df.to_csv" and "df.to_excel" to save my results and I can export them on Excel afterwards by downloading them. But at the end, it is not making my Excel file directly linked to the data acquired by my code.

1705500493097.png

If anyone could help me about that or tell me about another way to get data from Refinitiv DataBase to an Excel file. Thank you !

refinitiv-dataplatform-eikonrefinitiv-realtime#technologyrefinitiv-data-librariesrefinitiv-dataplatform-libraries
1705500493097.png (69.8 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
Accepted
22.1k 59 14 21

Hi @fjubin,

Codebook is a cloud based environment and this CSV/Excel file generated in the cloud and then downloaded to your local machine - cannot automatically get data from cloud.

For this you can use the Workspace Excel app (workspace plugin for Excel) and build your spreadsheet with Workspace formulas for Excel. This app is installed as a part of your Workspace installation. Once built, you can re-run all the formulas to get the latest data and update the spreadsheet.


1705505416077.png


1705505416077.png (4.2 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
5k 16 2 7

Hi @fjubin ,


Can you please elaborate on what you mean by saying "when the data changes". In your request you are getting historical prices for a given period. What change do you mean there?

Your approach of saving data from API to excel is correct, however when you save the dataframe output to csv/xlsx, it is stored in your local folder within Codebook.

Maybe I am missing something here, but it can't be linked to data change. If you want to update the content of your excel by, let's say adding data for more days, you need to change the API call to reflect it and save the new output to excel.


Best regards,

Haykaz

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Hi, thank you for your reponse.


Sorry for the lack of accuracy in my problem. My goal is to have an Excel file automatically getting data from cloud with the characteristics of a bunch of instruments. Over a period of 5 years until now (it is why the need of dynamism for the Excel file since "now" change every week").
But as @Gurpreet answered me, it seems impossible in the Codebook environment unless you have a solution. Meantime, trying to use the Refinitiv add-in in Excel seems the most practical solution.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.