I originally wrote this answer for your previous question , so it includes answers to some of your comments from there, but since you keep asking the community to write this step by step, here is the next step.
The problem I am facing is that if three tables go to the spreadsheet at the same time, with my code, it will update the very last cell, not all three. It makes sense?
Yes, that makes sense.
When the onEdit() trigger function calls the spreadsheet service functions to retrieve current information from the worksheet, it enters the Race condition. If, after the change caused by onEdit() , and when it is assigned, the changes occur on the worksheet, these changes will be visible when it is launched. This is what you see when you think that the change you are processing is in the last line - by the time you process it, there may be a new last line.
The good news is that the attributes of the event object passed to onEdit contain information about the change. (Parameter e .) See Event Objects .
Using e.range and e.value , you will find that you have the location and contents of the edited cell that clicked on the trigger. If additional tweets arrive before the trigger is serviced, your function will not be tricked when processing the last line.
In new sheets, onEdit() can be triggered for multi-core changes, such as cut and paste. As unlikely that this could happen, it's worth it.
Well, after the spreadsheet is all set up and actually uses the trigger from IFTTT, it doesn't work. :( I assume that it doesn't duplicate it as an active cell whenever it automatically pulls it into the spreadsheet. Any idea about a workaround?
Q: When editing is not edited? A: When it is done using a script. In this case, this is a change. You can add an installable function on Change to catch these events. Unfortunately, the change event is less detailed than the edit event, so you have to read the spreadsheet to find out what has changed. My habit is for the change handler to mimic editing by creating a fake event (as for testing) and passing it to the onEdit function.
So give it a try. This script:
- processes a list of "bad words". (You can also easily follow the mention of your product or reason.)
- has an
onEdit() function that uses an event object to evaluate the lines that caused the function to be called. - colors of bad tweets
- has a function to test the trigger onEdit () based on How to test the trigger function in GAS?
- includes
playCatchUp(e) , an installable trigger function (change and / or time) that will evaluate any lines that have not been previously evaluated. The Script property "Last Processed Row" used to track the value of this row. (If you plan to delete rows, you need to configure the property.) - The sendMail function is disabled.
Enjoy it!
