נוסחה או סקריפט לאיסוף כתובת מייל של עורכי שורות גוגל שיטס

411 views
Skip to first unread message

אוריאל בלמס

unread,
May 11, 2022, 5:00:30 AM5/11/22
to Google Apps Script Community
היי

יש לי גיליון שיטס שמשותף לכמה חברים בעבודה שלנו

ובכל שורה יש משימות שאנו צריכים לעדכן במידה וביצענו אותם  ..

ואני מעוניין שכאשר נעדכן את השורה שיהיה מעודכן באופן אוטומטי בעמודה A איזה עובד ביצע את המשימה הזו ?!

השאלה - האם יש נוסחה או סקריפט שתזהה את אותו בעל חשבון גוגל שממלא את השורה ?  
וכך כתובת המייל של העובד תתעדכן באופן אוטומטי לתוך התא שבעמודה A  ??

תודה רבה

זה מאוד יקל לנו

בברכה

אוריאל

Jon Couch

unread,
May 11, 2022, 7:53:36 AM5/11/22
to google-apps-sc...@googlegroups.com
Uriel, I don't believe it can be done with a formula, but a simple script can do it. Here's a good example:


This will give you the email address which you can then parse with SPLIT or LEFT to extract the username from email address if your application requires that. We typically just log the email address because we know it represents the user.

I hope this helps,
Jon Couch

--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/9b4e99d6-ad7c-436e-8fa6-7ddf73cf3d15n%40googlegroups.com.

אוריאל בלמס

unread,
May 13, 2022, 4:03:22 AM5/13/22
to Google Apps Script Community
היי ג'ון

תודה רבה לך מאוד מעריך את העזרה והידע שלך... הסקריפט הזה שהבאת הוא מצויין וזה עוזר לי כעת למשהו אחר שאני עובד עליו וזה ממש טוב ותודה רבה.

ניסיתי להשתמש  בסקריפט הזה למקרה שכתבתי לעיל

אך לא הצלחתי מ-2 סיבות: 
1. כי זה מחלץ את שם המשתמש רק לתא A1 ואילו אני צריך שזה יחלץ את זה לכל שורה ושורה כלומר- כל שורה שעובד מעדכן נתונים שיעודכן אוטומטית באותה שורה (בעמודה A)  מי מהעובדים עידכן את הנתונים שבאותה שורה באמצעות חילוץ שם המשתמש..
2. כי הסקריפט הזה לא פועל אוטומטי וצריך כל פעם להפעיל אותו ידני ואילו אני צריך צריך שיפעל אוטומטי ברגע שהעובד מעדכן את אותה שורה.

אני מעריך שבשביל להגיע לתוצאה הזו נדרש לשלב כמה סקריפטים , אם יש לך או למישהו כיוון לפיתרון בעניין אודה מאוד לעזרתכם

בתודה ובברכה

אוריאל


נ.ב.
ייתכן שגם אם נגיע לפיתרון שהסקריפט אכן יחלץ נתונים לכל עמודה A, לא ברור עדיין איך נוכל להגדיר שזה (לא יחלץ את שם המשתמש לכל השורות שבעמודה A אלא שזה) יחלץ את שם המשתמש אך ורק לשורה החדשה הספיציפית שהעובד ממלא ?! 


ב-יום רביעי, 11 במאי 2022 בשעה 14:53:36 UTC+3, ‪Jon Couch‬‏ כתב/ה:

Jon Couch

unread,
May 13, 2022, 10:12:37 AM5/13/22
to google-apps-sc...@googlegroups.com
Uriel, that script merely shows you the syntax for writing the current user. You will need some sort of routine that identifies what row you are currently on and then passes that to the getRange function. So that it says something like:

var row = sheet.getRow(); // you determine the best way to assign the row number, e.g. last row in the sheet, row that contains the edited cell, etc. in this example we're using the command for the current row the cursor is on

sheet.getRange(row,1).setValue(email); // so if row =4 this would file the email address in row 4 and column 1 - or A4

Hope that helps
Jon


Mr Song

unread,
May 15, 2022, 10:43:16 PM5/15/22
to google-apps-sc...@googlegroups.com
image.png

i want function 

function apptest(no)
{
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var sheet = ss.getActiveSheet();
  
  const url = "https://domeggook.com/ssl/api/" // POST URL

  var data = {
    'var''4.4',
    'mode''getItemView',
    'aid''2b2a3978dfbfc18769e3123a0ba29939',
    'no'no,
    'om''json'
  };
  var options = {
    'method''POST',
    'contentType''application/x-www-form-urlencoded; charset=UTF-8',
    'payload'JSON.stringify(data)
  };

  Logger.log(UrlFetchApp.fetch(urloptions));

  return UrlFetchApp.fetch(urloptions).getContentText()
}


<?xml version="1.0" encoding="utf-8"?>
<errors>
<code>20</code>
<message>API 인증 실패</message>
<dcode>NOT_REGISTED_KEY</dcode>
<dmessage>등록되지 않은 API KEY 입니다</dmessage>
<date>2022-05-16 11:33:13</date>
</errors>

2022년 5월 13일 (금) 오후 11:12, Jon Couch <jonc...@vt.edu>님이 작성:

Mr Song

unread,
May 16, 2022, 5:18:43 AM5/16/22
to google-apps-sc...@googlegroups.com
Hello.
I am going to use API POST request using Google apps script.

When tested with python, it is operating normally
I'm trying to test with Apps Script, but it's not working.

Python (http://openapi.domeggook.com/main/reference/detail?api_no=73&scope_code=SCP_OPEN)


param = dict()
param['ver'] = '4.4'
param['mode'] = 'getItemView'
param['aid'] = '2b2a3978dfbfc18769e3123a0ba29939'
param['no'] = 10383673
param['om'] = 'json'
res = requests.get(url, params=param)

<?xml version="1.0" encoding="utf-8"?> <domeggook> <basis> <no>10383673</no> <status> <![CDATA[판매중]]> </status> ...
</return> </domeggook>

Apps Script

const url = "https://domeggook.com/ssl/api/" // POST URL

var data = {
  'var''4.4',
  'mode''getItemView',
  'aid''2b2a3978dfbfc18769e3123a0ba29939',
  'no'no,
  'om''json'
};
var options = {
  'method''POST',
  'contentType''application/x-www-form-urlencoded; charset=UTF-8',
  'payload'JSON.stringify(data)
};

UrlFetchApp.fetch(urloptions);

<?xml version="1.0" encoding="utf-8"?> <errors> <code>20</code> <message>API 인증 실패</message> <dcode>NOT_REGISTED_KEY</dcode> <dmessage>등록되지 않은 API KEY 입니다</dmessage> <date>2022-05-16 10:53:16</date> </errors>

It works well when tested with python
AppsScript appears as an unregistered API Key.

I would like to ask if you could give me a sample to change the Python code to Apps Script.


2022년 5월 13일 (금) 오후 11:12, Jon Couch <jonc...@vt.edu>님이 작성:
Uriel, that script merely shows you the syntax for writing the current user. You will need some sort of routine that identifies what row you are currently on and then passes that to the getRange function. So that it says something like:

Andrew Roberts

unread,
May 16, 2022, 5:20:58 AM5/16/22
to google-apps-sc...@googlegroups.com
In the python you are using a GET (requests.get) rather than a POST (requests.post). This will add the params as a query string rather than a payload.

Reply all
Reply to author
Forward
0 new messages