I am new to google app script. I learnt that I can use UrlFetchApp.fetch("website address") to get the information from a simple webpage and then I can abstract the information subsequently.
However, if a webpage requires fill up some information and click a button to proceed to the result page. can I repeat the steps using google app script such that I can abstract the information on the result page? Thanks.
Example to illustrate the steps :
go to a webpage : https://usa.visa.com/support/consumer/travel-support/exchange-rate-calculator.html/
fill up information: as highlighted by red circles
after clicking the "Calculate Exchange Rates" button, the result page is shown:
Follow up discussion:
The below link is working and it will return the exchange rate I want to read in browser.
I then made a script as below:
but it return "You don't have permission to access". Is there any way out?
// Input parameters
var VisaYear = '2018';
var VisaMonth = '01';
var VisaDay = '05';
var toCurr = 'USD';
var fromCurr = 'JPY';
var fee = 1.95;
// download front page information
var root = "https://usa.visa.com/support/consumer/travel-support/exchange-rate-calculator.html"
var sub1 = '/?fromCurr='
var sub2 = '&toCurr='
var sub3 = '&fee='
var sub4 = '&exchangedate='
var sub5 = '%2F'
var sub6 = '%2F'
var sub7 = '&submitButton=Calculate+Exchange+Rates'
var RESOURCE_URL = root + sub1 + fromCurr +sub2 + toCurr + sub3 + fee + sub4 + VisaMonth + sub5 + VisaDay + sub6 + VisaYear + sub7
var data = UrlFetchApp.fetch(RESOURCE_URL,{muteHttpExceptions: true})
var rc = data.getResponseCode();
if (rc == 200) {
folder.createFile(FileName[1], data)