Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

Help to automatically save and import a .csv file from the web


This topic is 4950 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

I'm trying to create a script to automatically save and import a .csv file containing weekly currency exchange rates. The .csv file is available on the web.

The importing should be pretty easy, but how to automatically open the link and save the .csv file?

Any help would be really appreciated!

Posted

OK.

I'm going to explain you a simple way BUT you'll need to make some adjustment to the result.

1) place in the layout a tiny Web Viewer with this address: "http://www.bankofcanada.ca/en/markets/csv/exchange_eng.csv"

and give to the Web Viewer an Object Name ( like I did: "wv" ).

2) create an UNSTORED calculation field ( name it: FieldToExport ), with calc:

Let([

t = GetLayoutObjectAttribute ( "wv" ; "content" ) ;

start = Position ( t ; "year>)," ; 1 ; 1 ) + 10 ;

end = Position ( t ; "</PRE>" ; 1 ; 1 ) - 1

];

"Date," & Middle ( t ; start ; end - start )

)

3) Create a script with 3 steps:

Set Variable [ $path ; Value: "File:untitled.txt" ]

Export Field Contents [ YourTable::FieldToExport ; $path ]

Convert File [ No dialog ; $path ]

4) Fire that script and see the result

As I said, this is ONLY a starting point.

Posted

It didn't work for me. When I placed the web viewer on the page and specified the link, it opens up a seperate window in Excel. Then, exporting the contents web viewer created a file with just the word "data" in it.

This topic is 4950 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.