How to retrieve annual dividend for spreadsheets?

Skip to first unread message

BruceLynn Erickson

Oct 27, 2021, 12:19:40 PM10/27/21
to Dividend Investing for U.S. Investors
Hi all - simple, but probably not easy question...

How do you retrieve the current dividend being paid by a company.  Google finance has almost all of the other attributes I need for my tracking, but not the dividend paid.

Any ideas???

Bogdan D.

Oct 28, 2021, 1:45:51 PM10/28/21
to Dividend Investing for U.S. Investors
1. Go to  IEX Cloud, register for free account an get you API Key.
 2. In your Google Sheets Create a new function in by using Tools>Scripts editor.

Copy and paste this function in Google Apps Script:
function GETDIVIDEND2(symbl){
var key="[Your API KEY from IEX Cloud]";// replace [Your API KEY from IEX Cloud] with your API Key from IEX Cloud

  try {
    var recentDivi;
    var freq;
    var resnxt = UrlFetchApp.fetch(urlnxt);

      var content = resnxt.getContentText();
      var json = JSON.parse(content);
      recentDivi = json[0].amount;
      freq = json[0].frequency;
    if(freq.toLowerCase() =="quarterly"){
      return recentDivi*4;
    }else if(freq.toLowerCase() == "semi-annual"){
      return recentDivi*2;
    }else if(freq.toLowerCase() == "monthly"){
      return recentDivi*12;
    return 0;
  catch (err) {
    return 0;

Save the script and grant permission to the function to run.
Use the function to find out the dividend paid for which company you want. For example =GETDIVIDEND2("AAPL")


Dec 27, 2022, 2:34:59 PM12/27/22
to Dividend Investing for U.S. Investors
thanks a lot Bogdan D.

Franz Critchlow

Jun 1, 2023, 10:39:21 PM6/1/23
to Dividend Investing for U.S. Investors
Great suggestion and thanks.
Reply all
Reply to author
0 new messages