英文:
Looking For Solution to Automate Calendar Event Creation from Google Sheets
问题
背景:
在我的(新)工作中,我们有许多销售代表为我们的组织预订演出。直到现在,他们在我们的CRM(Pipedrive [PD])中处理他们所有的销售任务。然后,他们使用这些信息在PD的日历上创建一个“活动”(事件),该日历已经设置了与我们的通用工作日历(Outlook [OL])的双向同步。
问题:
由于不同代表编辑PD日历的数量,我们的组织的预订多样性以及一般的人为错误,我们的日历系统变得非常混乱。格式不一致,拼写错误,缺少必要信息,甚至纯粹错误的细节使我的工作(围绕每次预订创建程序,然后组织人才)几乎变得不可能。
“天才”“解决方案”:
尽管混乱不堪,但我讨厌那种在新岗位上立刻试图对已经在他们到来之前(不知何故)运作良好的系统进行更改的人。因此,我坐下来与代表们一起,了解了他们对日历的需求以及他们的流程,并构建了一个系统,不仅为我提供了所需的信息,而且还减少了他们一半的繁重工作。
以前,他们不仅要输入到PD中,然后手动创建事件,还要创建三个单独的Word文件,记录详细信息,创建事件的详细日程表,并根据事件类型概述合同需求。
因此,为了解决所有这些问题,我创建了一个表格(SS)模板,其中所有无关紧要的内容都预先填写了,可以从外部联系人数据库中填写所有联系信息,并根据“类型”和“开始时间”填写整个事件日程。 因此,他们只需要输入“地点”,“时间”和“内容”,表格会自动填充其余部分。
这对我有益的地方在于,我费尽心思地搜索了YouTube、Reddit和Stack Overflow上有关如何为Google构建脚本的信息。并成功创建了一个函数,可以从他们的新表单中提取所有信息,然后为我自动创建100%准确和一致的事件。
每个人都受益,对吧?
新问题:
由于超出了我当前的知识范围,我无法创建一种百分之百安全的方式让事件“触发”。我知道这与用户权限和简单触发器的限制有关等等,但我非常恼火的是,我成功地消除了大量繁重的工作,解决了我的问题,但最终阻碍我的是我必须主动去我的脚本中点击“运行”才能正常运作。
相关的额外细节:
正如我所说,我们使用Office,但我们可能会在将来转向Google(作为在艺术领域工作并在过去的二十年里一直是贫穷的学生/挣扎的艺术家,我比Microsoft更熟悉Google)。此外,我们还使用Monday.com并拥有一个Zappier账户。但我宁愿避免使用它们,因为在我来之前,他们每隔一两年似乎都更改了软件包,而且我们正在寻找新的执行主任,因此我不想因为其中一部分依赖于Zappier而导致整个系统崩溃,而我们的下任执行主任会从预算中削减它,你知道吗?
潜在解决方案:
我可以通过他们的可安装触发器使整个系统运行。然而,我发现它们具有一定的限制:
我可以通过“打开”来实现,每次打开SS时都会创建事件(这既令人讨厌又没有用,因为编辑发生在打开之后)。
我可以通过“编辑”或“更改”来实现,但这只会每次创建一个全新的事件。我甚至测试过,在一个无用的标签中进行了三次随机编辑,它创建了三个与第一个相同的事件(尽管这可能是我的第二脚本的解决方案…)。我希望它们可以根据特定单元格的onEdit来实现,因为那将非常有用。
我可以通过表单提交来实现…这意味着我可以创建一个他们填写的表单,然后创建整个文档,然后在他们提交后创建文档和事件,但这会限制为每个合同创建不同的SS的想法。
最后,我真的想避免的是,因为我不相信那些在三个不同地方拼错同一个名字的代表,他们不得不打开脚本并点击“运行”按钮,所以我可以创建一个通知我每当有更改时的宏,然后我可以手动点击按钮。但……那真的是最好的解决方案吗?
我知道这很多,但我更多地是寻找创造性的编码方式来解决一个一般性问题,而不是单一问题的具体修复。任何能够实现我想要的目标,而不需要我执行令人讨厌的额外步骤,或者不需要我信任他人处理键盘的建议,我都愿意听取!
英文:
Background:
At my (new) job, we have a number of Sales Reps who book gigs for our organization. Until now, they handle all of their sales tasks in our CRM (Pipedrive [PD]). They then use that information to create an "activity" (event) on PD's calendar, which is set up for two-way sync with our general work Calendar (Outlook [OL]).
Problem:
Between the number of different Reps who edit the PD Calendar, the variety in bookings for our org, and just general human error, our Calendar system is a NIGHTMARE. Formatting inconsistencies, typos, lack of necessary information, and even straight up wrong details make my job (creating a program around, and then organizing the talent for each booking) nearly impossible.
"Genius" "Solution":
Even though it's a mess, I hate the type of person who comes into a new position and instantly tries to make changes to a system that has (somehow) worked before their arrival. So instead I sat down with the reps, learned what their needs were for the calendar, as well as their process, and built a system that not only gives me what I need, but also cuts the busy work on their end in half.
Previously, they not only entered into into PD, and then manually created the events, they also created three separate supplementary Word files that documented the details, created a detailed schedule of events, and outlined contractual needs based on the type of event.
So to solve all of this, I created a Spreadsheet (SS) Template that had all the fluff prefilled, was able to fill in all the contact info from an external contact database, and fill in the entire event schedule based on "type" and "start time". So basically they just need to enter in "Where", When", and "What", and the SS would auto populate the rest.
How that benefits me, is I then painstakingly scoured YouTube, Reddit, and Stack overflow for information on how to build Scripts for Google. And managed to make a function that can pull all the information from their new fancy form, and automatically create a 100% accurate and consistent Event for me.
Everybody wins, right?
New Problem:
Due to things well beyond my current knowledge, I am unable to create a dummy proof way for the event to "Trigger". I know it has to do with user permissions, and the limitations of Simple Triggers yada yada, but I'm incredibly annoyed that I managed to eliminate so much busy work, entirely solve my problem in the process, and yet the thing blocking me in the end is that I have to actively go to my Script and hit "Run" for it to properly function.
(For any "Expedition Force" readers out there, this feels a lot like how for so long Skippy could program intricate FTL Jumps across Spacetime, but still needed a "filthy monkey" to push the "jump" button)
Relevant Additional Details:
As I said, we use Office, but we're likely switching to Google down the road (and as someone who works in the arts and has been a poor student/struggling artist for the last two decades, I am much more versed with Google than Microsoft. I've also rarely found anything of value within my needs that one could do that the other couldn't, so I've built this whole system in Google Apps Script. However, if someone finds a potential solution where this will work in Excel with VBA instead, then I'd learn to translate what I've written so far.
Also, the Script works. I can make it work 100% of the time via the Apps Dashboard (where they don't worry as much about permissions), so it's not a problem with the code itself, which is why I haven't posted it here (but I can if anyone has a reason to think it's relevant).
It is a frequent need for our Reps to go in and edit the gig (people get sick, availabilities change, or mistakes were made the first time, etc.), so to combat this, I've actually written two Scripts. The first is a "Create" script which takes all the information, creates an event, and then pulls the EventID # which it pastes in a safe cell on a different tab. The second is an "Edit" script which searches for the previously created event by ID, and then makes the changes as needed.
In addition to PD and Office, we also use Monday.com and have a Zappier account. But I'd rather avoid either of those if possible since they have apparently changed software packages every other year before I got here, and we are in the middle of a search for a new Executive Director, so I'd rather not have this whole thing come crashing down because one minor part of it depended on Zappier, which our next ED cut from the budget, ya know?
Potential Solutions:
I can make the whole thing run via their Installable Triggers. However, I find them limiting:
I can do it by "Open" which creates the event every single time the SS is opened (which is both obnoxious AND useless, since the edits happen AFTER it is opened).
I can do it by "Edit" or by "Change", but again this just creates a whole new Event every time. I even tested it and made three random edits on empty cells in a useless tab, and it made three identical events to match the first (although this could be a solution for my 2nd Script...). I wish they could do onEdit of specific Cell, because THAT would be useful.
I can do it by form submission.. which means I can instead make a form that they fill out that creates the whole doc, and after they submit, it creates the doc AND event, but this limits the idea of having a different SS for every contract.
And lastly, which I really want to avoid, since I don't trust the Reps who manage to spell the same name wrong three different ways in three different places with having to open Scripts and hit "run", I could create a macro that notifies ME whenever changes are made, and then I could go in and manually hit the button. But..... Is that REALLY the best solution?
I know that's a lot, but I'm more looking for creative coding ways to solve a general problem, rather than a specific fix to a single string. Anything that could make what I want happen, without making me do annoying extra steps, or without requiring me to trust others with a keyboard, I am open to suggestions!
答案1
得分: 0
以下是您要求的翻译部分:
You would benefit from more research on triggers gerenally, onEdit
in particular. It is broadly true that onEdit
is triggered "when anything was edited" but the script can be written so that it evaluates specific rows &/or columns &/or cells &/or sheets &/or values. It can do this by using Event Objects which involve including an argument (often the letter "e", or the word "event"). The Event objects provide a lot of information about the nature of the edit.
在这方面,您可以从更多关于触发器的研究中受益,特别是onEdit
。确实,onEdit
通常会在"任何内容被编辑"时触发,但脚本可以编写成仅在特定行、列、单元格、工作表或数值发生变化时触发。这可以通过使用事件对象来实现,通常需要包括一个参数(通常是字母 "e" 或单词 "event")。事件对象提供了有关编辑性质的许多信息。
For example, if you had a checkbox in sheet "Sheet2", column D, and you wanted to trigger something if the checkbox value was changed to "checked", then an onEdit(e)
script might include an IF
statement such as:
例如,如果您在名为 "Sheet2" 的工作表的D列中有一个复选框,并且希望在复选框的值更改为 "checked" 时触发某些操作,那么 onEdit(e)
脚本可能包括类似以下的 IF
语句:
if(e.range.getSheet().getName() == "Sheet2" && e.range.columnStart == 4 && e.value == true){//do stuff}
In the scenario described, an automated trigger might not be necessary - a user might select a row (or a cell in a row), and click the "Button" in order to execute the script. However, it might be desirable to "check" a checkbox
so that there is no doubt about that row has been calendarized or not. The advantage of this is that an event is not calendarized twice.
在所描述的情境中,可能不需要自动触发器 - 用户可以选择一行(或一行中的单元格),然后单击"按钮"以执行脚本。但是,_可能_希望"检查"一个复选框,以确保是否已经对该行进行了日历化。这样做的好处是事件不会被重复日历化。
The following script might be an appropriate example:
以下脚本可能是一个合适的示例:
function buttonTrigger() {
var ss = SpreadsheetApp.getActiveSpreadsheet()
var sheetName = "Sheet1"
var sheet = ss.getSheetByName(sheetName)
// get the row to be calendarized
var row = sheet.getCurrentCell().getRow()
// Logger.log("DEBUG: the cursor is on row is "+row)
// check is this row is already processed
if (sheet.getRange(row,4).getValue == true){
// this row already processed
// insert abend code
return
}
else{
// this row is OK to update
// insert script to calendarize event
// update checkbox to show event is updated
// checkbox is in Column 4
sheet.getRange(row,4).setValue("true")
}
}
Example
示例
Creating a button and assigning a script
创建按钮并分配脚本
There is a good explanation of this process in StackOverflow topic Run script only on click on button instead with open the sheets
有关此过程的很好解释,请参阅StackOverflow主题Run script only on click on button instead with open the sheets
英文:
You would benefit from more research on triggers gerenally, onEdit
in particular. It is broadly true that onEdit
is triggered "when anything was edited" but the script can be written so that it evaluates specific rows &/or columns &/or cells &/or sheets &/or values. It can do this by using Event Objects which involve including an argument (often the letter "e", or the word "event"). The Event objects provide a lot of information about the nature of the edit.
For example, if you had a checkbox in sheet "Sheet2", column D, and you wanted to trigger something if the checkbox value was changed to "checked", then an onEdit(e)
script might include an IF
statement such as:
if(e.range.getSheet().getName() == "Sheet2" && e.range.columnStart == 4 && e.value == true){//do stuff}
In the scenario described, an automated trigger might not be necessary - a user might select a row (or a cell in a row), and click the "Button" in order to execute the script. However, it might be desirable to "check" a checkbox
so that there is no doubt about that row has been calendarized or not. The advantage of this is that an event is not calendarized twice.
The following script might be an appropriate example:
function buttonTrigger() {
var ss = SpreadsheetApp.getActiveSpreadsheet()
var sheetName = "Sheet1"
var sheet = ss.getSheetByName(sheetName)
// get the row to be calendarized
var row = sheet.getCurrentCell().getRow()
// Logger.log("DEBUG: the cursor is on row is "+row)
// check is this row is already processed
if (sheet.getRange(row,4).getValue == true){
// this row already processed
// insert abend code
return
}
else{
// this row is OK to update
// insert script to calendarize event
// update checkbox to show event is updated
// checkbox is in Column 4
sheet.getRange(row,4).setValue("true")
}
}
Example
Creating a button and assigning a script
There is a good explanation of this process in StackOverflow topic Run script only on click on button instead with open the sheets
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论