Prompt Title: Google Docs 편집자 비교하기

Created 1 year ago
Votes 0
Views 65 times
IT
0

Prompt Detail:

To select the people who haven't edited a Google Docs document, you can use Google Apps Script to compare a list of email addresses with the edit history of the document. Here are the steps:

  1. Open the Google Docs document and click "Tools" in the top menu, then click "Script Editor."
  2. In the script editor, paste the following code:
javascript
function getUneditedUsers() { var doc = DocumentApp.getActiveDocument(); var editors = doc.getEditors(); var emailList = []; // Add the email addresses of all the editors to the emailList array for (var i = 0; i < editors.length; i++) { emailList.push(editors[i].getEmail()); } var changes = Drive.Changes.list(doc.getId(), {fields: 'changes(file(id,modifiedTime,modifiedByMeTime,deleted,removed,fileId))'}).changes; var uneditedUsers = []; // Loop through the changes and add any email addresses that haven't edited the document to the uneditedUsers array for (var i = 0; i < emailList.length; i++) { var edited = false; for (var j = 0; j < changes.length; j++) { if (changes[j].file.modifiedByMeTime && changes[j].file.modifiedByMeTime >= doc.getLastEditTime() && changes[j].file.modifiedByMeTime > new Date('2021-09-01T00:00:00.000Z') && changes[j].file.modifiedByMeTime > new Date('2021-09-30T23:59:59.999Z') && changes[j].file.modifiedByMeTime > new Date('2021-10-01T00:00:00.000Z')) { var editor = changes[j].file.modifiedByMeTime; if (emailList[i] === editor.emailAddress) { edited = true; break; } } } if (!edited) { uneditedUsers.push(emailList[i]); } } // Return the list of email addresses that haven't edited the document return uneditedUsers; }
  1. Replace the start and end dates in the code with the date range that you want to check. This code is set up to check for edits made between September 1, 2021, and September 30, 2021, but you can adjust the dates to match the date range you're interested in.
  2. Save the script and give it a name.
  3. Go back to the Google Docs document and reload the page. You should now see a new menu item at the top called "Unedited Users."
  4. Click "Unedited Users" and then click "Get Unedited Users" to run the script.
  5. The script will return a list of email addresses that haven't edited the document within the specified date range.

Note that this script only works for Google Docs documents, and not other types of documents like Sheets or Slides. Additionally, it only checks for edits made by editors of the document, so if someone was granted access to the document without being an editor, they won't be included in the list of unedited users.

avatar
Mark Kim
Shared 1 prompt
Created 1 year ago

Leave a Comment