Time Trigger Copy Paste - google-apps-script

I'm fairly new to Google scripts and so far I only have a functional understanding of 'onEdit'. I want to incorporate Google's time triggers however I don't know how to do it due to lack of understanding.
Here is what I am trying to do:
Objective: Create a spreadsheet that keeps track of metrics on a weekly basis
Current Set up: Currently, the spreadsheet uses 'CountIF' on a queried spreadsheet from multiple users to compile all the data and determine the status of every to-do item at any moment.
Need: I would like to set up a script that takes affect every Sunday. The script would copy the metrics from the previous week and paste them into a row below based upon the start date and date date of the previous week (Which are kept in columns A ad B...Ex: 7/7/2018 & 7/14/2018. If the previous week falls into this date range, the cumulative metrics for that week will paste into columns C-L of that week.
Essentially, row 3 would always keep the running total and then the rows below row 3 would populate with a "total to date" for the given date range.

In your Apps Script editor go to Edit > Current Projects Triggers and select Time Driven > Week Timer.

Related

google spreadsheet Real time importrange not reliable

I have 2 google spreadsheet
a membership database // with 8 column of data for 1 record. Currently there are around 3000 record in the sheet and it is growing at a rate of around 1500 records per month. New members enter these info via a google form. And then I wrote some apps script to assign membership number to each record in numeric order e.g. KS000001--->KS000002 with onSubmit trigger.
a sales record // which import the entire membership database with function importrange and record sales.
Whenever I enter a sales record, I need to check if he is a registered member in real time and match the sales record with the respective membership number.
Sometimes the importrange just doesnt work and shows #REF
This is the function I use
=ImportRange("xxxxsheetidxxxxxx","Membership DB!A1:I5000")
Is there a more reliable way to do this? I need this in real time for today newly joined member.
The idea I have in mind is to cut the database into two parts and update it everynight.
Method:
Copy the entire membership database to the sales record at 12:00am. e.g. record (KS000001-KS003000). Use importrange to import the newly joined member during the day e.g. record (KS003001 - latest). Both array are in the same column A:I for easier look up.
Is there any better alternatives?
Thank you

IF TIME NOT BETWEEN SHEETS

this is my first thread in this forum.
i want to ask, the proper functions on google sheets to calculate this "SLA" Column.
the case i facing is, i want made the "SLA" Column refers to "Start Time" is not between work hour ( 07.00 AM To 17.00 PM ). or the simple word is whenever start time not in work hour the SLA will shows zero or 00:00:00.
also i have start time and end time to calculate to the "SLA".
how to combine those functions, so i can get the result if on work hour or off work hour
thanks
the tables

Creating an automatic and self-generating weekday data entry sheet in google sheets

In short, I need admins at my work to be able to punch in whether someone is on leave or not into a sheet that informs other sheets to create daily staffing lineups all based in Google Sheets. Right now, I have them deleting whole columns of values and keeping track of what day it is every day. Obviously this is open to error and is a task I'd like to eliminate.
Essentially, I have 7 cell-wide table with the first one being =today() and each one in that row being =today()+1 through =today()+6. What I want to see happen is for the values (underneath) that correspond to that day move (to the left) as the date updates. Furthermore, icing on the cake, I need the new =today()+6 to automatically generate with "no" in each cell under that newly generated date (column H in the below example).
For example, in my submitted sheet, today Karen is OFF in column B. However, in two days time she'll be on VAC which, by that time, should be column B.
I appreciate any help.
Schedule
Here's a link to the sample sheet
Your task can be done if you change the way your managers enter data. If they fill out the data in a table like this
then your master table would look like this
you need to clear the contents in the range B5:H9 and copy the following formula into cell B5
=ArrayFormula(IFNA(VLOOKUP(TRUE&TRUE&$A5:$A,{(Sheet2! $A:$A<=B3)&(Sheet2!$B:$B>=B3)&Sheet2!$C:$C,Sheet2!$D:$D},2,FALSE), "no"))
Then you need to extend this formula to cell B9

How to find out the last task assigned and its time allowed using appscript & google sheets

I get data like this, wherein tasks are being assigned to employees on a daily basis mostly 2 - 3 tasks every day.
The timestamp column shows when was the last task allotted.
What I need is a summary of the following details:
How many employees were assigned the tasks and their details as in their Ids and Names?
What was the last task assigned to them based on the timestamp.
What is the time allowed as per the standards
Only current date's data should show up there.
Something like this:
Time allowed should come from the time allowed standard sheet.
Please help me in knowing how to do it with appscript...
Thanks in advance

How can you generate a report for newly created groups/DLs on a weekly basis?

I am an admin for a Google Apps for Business domain and we want to be able to run a report to tell us what groups have been created in the last week. There is no such "Date Created" column for the groups. The best I have been able to do so far is run a list of the groups on a weekly basis but I want to be able to automate comparing that to the list from the week before.
You might as well store the list you have goten in a 'permanent storage' - a spreadsheet, ScriptDB or script Properties - and proceed to a comparison every week to see if something has been added (or removed)... This is maybe less straightforward and elegant but might be simpler to get working.
The weekly triggered function could do this :
get the list of names
sort it
write the sorted list to spreadsheet
retrieve the sorted list from last week by reading the preceding row in spreadsheet
compare both sorted lists at array level
and send yourself a mail with the difference.(eventually write the log to the spreadsheet)
This is certainly possible but requires a bit of coding.
You'll have to use the Audit API for this. See this response for some starter code on how to make basic calls to the API. The one tricky part is to set up OAuth 2 but its very possible after that.
Once you have the setup working you can then add additional startTime and endTime parameters to define your week interval along with the CREATE_GROUP event filter in the URL.