Q:

Trying to get a count of labels used in Gmail using Gmail API

I am trying to go one level deeper with the demo code that utilises labels to extract the count of each label used within my inbox. e.g label1 = 5, label2 =10 etc and with a date. Any suggestions?
Demo code:
function listLabels() {
  var response = Gmail.Users.Labels.list('me');
  if (response.labels.length == 0) {
    Logger.log('No labels found.');
  } else {
    Logger.log('Labels:');
    for (var i = 0; i < response.labels.length; i++) {
      var label = response.labels[i];
      Logger.log('- %s', label.name);
    }
  }
}

A:

Using the Users.messages:list function call from the GMail API should get you your results. 
The trick here is to pass label.id to the labelIds argument as a list
function listLabels() {
  var response = Gmail.Users.Labels.list('me');
  if (response.labels.length == 0) {
    Logger.log('No labels found.');
  } else {
    Logger.log('Labels:');
    for (var i = 0; i < response.labels.length; i++) {
      var label = response.labels[i];

      // Use the label name to get the messages that match this label
      var label_messages = Gmail.Users.Messages.list('me', {'labelIds': [label.id]});

      Logger.log('%s = %s', label.name, label_messages.resultSizeEstimate);
    }
  }
}

