AI-generated Key Takeaways
-
The Admin SDK Reports service enables Google Workspace administrators to create custom usage reports within Apps Script, using the Admin SDK's Reports API.
-
This advanced service requires prior enabling and mirrors the functionalities of the public API, using the same objects, methods, and parameters.
-
Sample code is provided demonstrating how to generate login activity reports (including time, user, and login result) and user usage reports (including date, user, last login, emails received, and docs created) for a specified timeframe, outputting the data into a spreadsheet.
-
Comprehensive reference documentation and a support guide for the Admin SDK Reports API are available for further information and assistance.
The Admin SDK Reports service allows you to use the Admin SDK's Reports API in Apps Script. This API gives administrators of Google Workspace domains (including resellers) the ability to create custom usage reports for their domain.
Reference
For detailed information on this service, see the reference documentation for the Admin SDK Reports API. Like all advanced services in Apps Script, the Admin SDK Reports service uses the same objects, methods, and parameters as the public API. For more information, see How method signatures are determined.
To report issues and find other support, see the Admin SDK Reports support guide.
Sample code
The sample code below uses version 1 of the API.
Generate login activity report
This sample generates a login activity report for the last week as a spreadsheet. The report includes the time, user, and login result.
Generate user usage report
This sample generates a user usage report for this day last week as a spreadsheet. The report includes the date, user, last login time, number of emails received, and number of docs owned.