This is an update the last tutorial about Google Apps Script and shows you how to use App
First, you need to update your Advanced Google services.
Open an empty google document text or spreadsheet and using the main menu to open the Script editor from the menu Tools.
You need to enable the API from the menu of Script editor on Resources – Advanced Google services with your Google Apps Script project.
In this case, I enable the AppsActivity with version 1, see the screenshot:
When you check this to on, you need to agree with these settings and your Google account permission.
To do that, see the next screenshots:
This will let you to use the application.
Now, I can see my activity using AppsActivity.
In your Script editor add this source code and run it, the output is shown with the main menu, the View and Logs, or use Ctrl + Enter keys.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | function my_list_Activity() { var optionalArgs = { 'source': 'drive.google.com', 'drive.ancestorId': 'root', 'pageSize': 10 }; var response = AppsActivity.Activities.list(optionalArgs); var activities = response.activities; if (activities && activities.length > 0) { Logger.log('Recent activity:'); for (i = 0; i < activities.length; i++) { var activity = activities[i]; var event = activity.combinedEvent; var user = event.user; var target = event.target; if (user == null || target == null) { continue; } else { var time = new Date(Number(event.eventTimeMillis)); Logger.log('%s: %s, %s, %s (%s)', time, user.name, event.primaryEventType, target.name, target.mimeType); } } } else { Logger.log('No recent activity'); } } |
The output of this source code on my account is this…
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | [20-05-24 14:37:57:614 EEST] Recent activity: [20-05-24 14:37:57:631 EEST] Sun May 24 14:33:44 GMT+03:00 2020: Cătălin George Feștilă, edit, listActivity (application/vnd.google-apps.script) [20-05-24 14:37:57:633 EEST] Sun May 24 13:59:49 GMT+03:00 2020: Cătălin George Feștilă, edit, listActivity (application/vnd.google-apps.script) [20-05-24 14:37:57:635 EEST] Sun May 24 13:52:52 GMT+03:00 2020: Cătălin George Feștilă, rename, listActivity (application/vnd.google-apps.script) [20-05-24 14:37:57:637 EEST] Sun May 24 13:52:48 GMT+03:00 2020: Cătălin George Feștilă, edit, Untitled project (application/vnd.google-apps.script) [20-05-24 14:37:57:640 EEST] Sun May 24 13:46:00 GMT+03:00 2020: Cătălin George Feștilă, create, simple_test_file_id (application/vnd.google-apps.document) [20-05-24 14:37:57:642 EEST] Thu Apr 23 21:16:41 GMT+03:00 2020: Cătălin George Feștilă, create, Starting_Lua (application/vnd.google-apps.document) [20-05-24 14:37:57:645 EEST] Thu Apr 23 21:16:16 GMT+03:00 2020: Cătălin George Feștilă, create, Lua (application/vnd.google-apps.folder) [20-05-24 14:37:57:647 EEST] Sun Apr 19 18:49:08 GMT+03:00 2020: Cătălin George Feștilă, edit, python_imdb_001.ipynb (application/vnd.google.colaboratory) [20-05-24 14:37:57:649 EEST] Sun Apr 19 18:46:02 GMT+03:00 2020: Cătălin George Feștilă, edit, python_imdb_001.ipynb (application/vnd.google.colaboratory) [20-05-24 14:37:57:651 EEST] Sun Apr 19 18:43:18 GMT+03:00 2020: Cătălin George Feștilă, edit, photo_test.ipynb (application/vnd.google.colaboratory) [20-05-24 14:37:57:654 EEST] Sun Apr 19 18:41:50 GMT+03:00 2020: Cătălin George Feștilă, rename, python_imdb_001.ipynb (application/vnd.google.colaboratory) [20-05-24 14:37:57:656 EEST] Sun Apr 19 18:41:19 GMT+03:00 2020: Cătălin George Feștilă, edit, Untitled0.ipynb (application/vnd.google.colaboratory) [20-05-24 14:37:57:659 EEST] Sun Apr 19 18:39:46 GMT+03:00 2020: Cătălin George Feștilă, rename, Untitled0.ipynb (application/vnd.google.colaboratory) [20-05-24 14:37:57:661 EEST] Sun Apr 19 18:39:12 GMT+03:00 2020: Cătălin George Feștilă, upload, Untitled (application/vnd.google.colaboratory) [20-05-24 14:37:57:663 EEST] Sun Apr 19 18:39:06 GMT+03:00 2020: Cătălin George Feștilă, rename, photo_test.ipynb (application/vnd.google.colaboratory) [20-05-24 14:37:57:665 EEST] Sun Apr 19 18:37:45 GMT+03:00 2020: Cătălin George Feștilă, edit, Untitled0.ipynb (application/vnd.google.colaboratory) [20-05-24 14:37:57:668 EEST] Sun Apr 19 18:36:54 GMT+03:00 2020: Cătălin George Feștilă, untrash, Copy of catafest_004.ipynb (application/vnd.google.colaboratory) [20-05-24 14:37:57:670 EEST] Sun Apr 19 18:36:13 GMT+03:00 2020: Cătălin George Feștilă, rename, Untitled0.ipynb (application/vnd.google.colaboratory) [20-05-24 14:37:57:672 EEST] Sun Apr 19 18:35:38 GMT+03:00 2020: Cătălin George Feștilă, upload, Untitled (application/vnd.google.colaboratory) |