Apps Activity Service

The Apps Activity service allows you to use the Apps Activity API in Apps Script. This API allows users programmatic access to retrieve information about their Google Apps activity.


For detailed information on this service, see the reference documentation for the Apps Activity API. Like all advanced services in Apps Script, the Apps Activity service uses the same objects, methods, and parameters as the public API.

Sample code

The sample code below uses version 1 of the API.

Get a file's activity

This sample gets a file's activity and logs the list of unique users that performed the activity.

function getUsersActivity() {
  var fileId = 'YOUR_FILE_ID_HERE';

  var pageToken;
  var users = {};
  do {
    var result = AppsActivity.Activities.list({
      'drive.fileId': fileId,
      'source': '',
      'pageToken': pageToken
    var activities = result.activities;
    for (var i = 0; i < activities.length; i++) {
      var events = activities[i].singleEvents;
      for (var j = 0; j < events.length; j++) {
        var event = events[j];
        users[] = true;
    pageToken = result.nextPageToken;
  } while (pageToken);

Send feedback about...

Apps Script
Apps Script
Need help? Visit our support page.