Scrape Yahoo Finance for Stock Information with Google Scripts

Published in: Google Apps Script

If you know the the stock symbol like MSFT or GOOG, you can get the full name of the corresponding company by scraping the Yahoo Finance website for that symbol.

function getFundFullName(stockSymbol) {

  var url = "" + stockSymbol;

  var response = UrlFetchApp.fetch(url, {muteHttpExceptions: true});

  if (response.getResponseCode()) {

    var html = response.getContentText();

    var title = html.match(/<h2>([^>]+)\(\^?/);

    if (title) return title[1];


  return stockSymbol;

Published in: Google Apps Script

Looking for something? Find here!

Meet the Author

Web Geek, Google Developer Expert
Amit Agarwal

Amit Agarwal is a Google Developer Expert in Google Workspace and Google Apps Script. He holds an engineering degree in Computer Science (I.I.T.) and is the first professional blogger in India. He is the developer of Mail Merge for Gmail and Document Studio. Read more on Lifehacker and YourStory

Get in touch