Get Stock Data from Yahoo Finance in Google Spreadsheets

Google Finance is no longer integrated with Google Apps Script but you can still use Yahoo Finance with the URLFetch service to bring stock data from the Yahoo website into your Google Spreadsheet. Yahoo Finance data is available in CSV format that can be parsed with parseCSV method of Google Scripts.