title: Automatic retrieval of flight prices in Google Sheets using IMPORTXML function
body: <p>I am planning to visit South America next year with a couple of friends.  We created a Google Spreadsheet with different dates of arriving and departing airports.  The problem is that when we complied the file, it was already outdated since the prices are changing every hour/day.  I thought to create a script or an <code>IMPORTXML</code> function to automatically retrieve the data from the websites. The data would refresh every time I open the file.  <code>IMPORTXML</code> might work but I was not able to configure it properly. I am assigning a cell to this function:</p>
  
  <pre><code>=IMPORTXML("https://www.klm.com/travel/de_en/apps/ebt/calendar.htm?application=EBT7&amp;country=DE&amp;language=en&amp;barsEnabled=true&amp;fixedDatesOnly=false&amp;canModify=ORIGIN%2CDESTINATION%2CTRAVELDATES%2CPAX%2CCABINCLASS%2CURL&amp;trip=MAD:A:20200701%3ERIO:C-RIO:C:20200719%3EMAD:A&amp;numberOfAdults=1&amp;numberOfYoungAdults=&amp;numberOfChildren=&amp;numberOfInfants=&amp;cabinClass=ECONOMY&amp;outboundMonth=", "//*[@id=""brandedFaresWidgetContainer""]/div/div/div[4]/div[2]/div/ul/li[1]/div[1]/div/div/div[4]/button/span")
  </code></pre>
  
  <p>I am only getting N/A in the cell. I think this is because the <code>IMPORTXML</code> function has an internal timeout which expires before the webpage (<a href="https://www.klm.com/travel/de_en/apps/ebt/calendar.htm?application=EBT7&amp;country=DE&amp;language=en&amp;barsEnabled=true&amp;fixedDatesOnly=false&amp;canModify=ORIGIN%2CDESTINATION%2CTRAVELDATES%2CPAX%2CCABINCLASS%2CURL&amp;trip=MAD:A:20200701%3ERIO:C-RIO:C:20200719%3EMAD:A&amp;numberOfAdults=1&amp;numberOfYoungAdults=&amp;numberOfChildren=&amp;numberOfInfants=&amp;cabinClass=ECONOMY&amp;outboundMonth=" rel="nofollow noreferrer">link</a>) is loaded so it cannot really retrieve the element. The problem is that I didn't find a way to increase the timeout of this function. For the <code>XPATH</code> I am using the built-in copy XPATH location in Google Chrome Developer Tools</p>
  
  <p>How can I retrieve this price from the Internet and populate it into a Google Spreadsheet cell? </p>