function getSentiments() {
  ss.toast('Analyzing the headline sentiments...');

  let articleCount = rows.getNumRows() - 1;
  let avg = 0;

  // Gets sentiment for each row 
  for (let i = 1; i <= articleCount; i++) {
    let headlineCell = rowValues[i][headlineCol];
    if (headlineCell) {
      let sentimentData = retrieveSentiment(headlineCell);
      let result = sentimentData['documentSentiment']['score'];
      avg += result;
      ds.getRange(i + 1, sentimentCol + 1).setBackgroundColor(getColor(result));
      ds.getRange(i + 1, sentimentCol + 1).setValue(getFace(result));
      ds.getRange(i + 1, scoreCol + 1).setValue(result);
    }
  }
  let avgDecimal = (avg / articleCount).toFixed(2);
 
  // Shows news topic and average face, color and sentiment value.
  bottomRow = articleCount + 3;
  ds.getRange(bottomRow, 1, headlines.length, scoreCol+1).setFontWeight('bold');
  ds.getRange(bottomRow, headlineCol + 1).setValue('Topic: \"' + topic + '\"');
  ds.getRange(bottomRow, headlineCol + 2).setValue('Avg:');
  ds.getRange(bottomRow, sentimentCol + 1).setValue(getFace(avgDecimal));
  ds.getRange(bottomRow, sentimentCol + 1).setBackgroundColor(getColor(avgDecimal));
  ds.getRange(bottomRow, scoreCol + 1).setValue(avgDecimal);
  ss.toast("Done!!");
}
For each article cell, calls the Natural Language API to get general sentiment and then updates 
the sentiment response columns.