May 2, 201114 yr 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!
May 2, 201114 yr Author It's a link to the last five days of currency exchange rates, as published by the Bank of Canada: http://www.bankofcanada.ca/en/markets/csv/exchange_eng.csv
May 2, 201114 yr 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.
May 4, 201114 yr Author 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.
Create an account or sign in to comment