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
Related
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
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
I have a firestore database that looks like this
/entries/ ....
/users/{userid}...
a bunch of documents is being sent into ... of entries and userid contains on 8 docs of user profile information.
my problem is that the entries doc contains field hours and no relation to the user doc which contains the field weekly_capacity
I need to aggregate this the two fields hours/weekly capacity setting them to Full-time equivalency variable
But the Full-time equivalency needs to be accurate and this company FTE can change so it would need to calculate the FTE over various date even if the user changed their FTE status x number of times.
And the current app only fetched the entries when the user logins into the app, which can be whenever.
None of the API requests that I am using will give me a json that holds both weekly_capacity and hours on the same fetch. If every time a user logs into the app firestore calls the http to fetch all entries then how can I compare the hours field on the collection's entries to the weekly_capacity field
Just a little context: FTE = Full-time equivalency and is used to measure as a standard to see if an employee compares to there core commit hours they signed up for which is 40. SO if I agreed to work 40 and I work actually work 40 hours then I would be 1 whole FTE. If I worked 20 and I suppose to work 40 I am .5 FTE. The math is really simple it's just that in my situation the variable FTE can change any time and the app will allow the user to enter a range of dates fetching the total actual hours they worked and FTE letting them know how many hours they were supposed to work vs how many hours they actually worked. Since the variable changes, I need some way in firestore to track the change and aggregate correctly against the hours actually worked. To give an error example: let's say I changed my FTE from 1 to .7 on March 20th, I then want to generate a report of March 1 to March 30th stating my hours worked and FTE status meaning did I reach my goal. The kicker is that I can't fetch or merge the entries which hold the var hours and /users/ which hold the var weekly_capacity.
I don't even think a cloud function would solve the problem since entries are only fetched when the user logins in right?
I'm assuming the following for answering your question.
Requirement: To calculate FTE for a user when user's weekly_capacity is updated or user logs in.
Problems:
Some way in firestore to track the change.
Calculate FTE correctly according to the change.
Here's what I think will solve the problems.
Google Cloud Firestore supports listeners for the collections in which you store the data. So you can listen for any change in users collection and entries collection. This is how you can track the change.
To calculate FTE, when a change is made to weekly_capacity of user document or a new entry is made to entries collection you need to query both collections separately to get the records corresponding to the user affected. You can also use a collections-group query for this purpose but that depends on your database design.
Hope that helps.
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.
I'm writing a script for an insurance agency that will work like this:
When an employee makes a sale, they enter information about each policy they sold (name, policy number, etc.) in their own Google Spreadsheet, one policy per row.
Script takes spreadsheets from every employee as input and writes them to a table in database.
When policies get paid, they get written to a separate table.
I use an OUTER JOIN to see which employee sold each paid policy.
The issue I'm having is that in step 2, I don't want to write policies to the database that have already been written (i.e. because they were there last time I ran the script). I can think of a few ways to solve this...
Clear the table every time I run the script, so it's being written fresh every time.
Loop through and check if a given policy is already in the database before writing it to DB.
Add a boolean column called "copied to DB", when adding rows to DB check if "copied to DB" is equal to "Yes": if true, don't write the row to DB; if false, change "copied to DB" to yes and write the row to the DB.
I think any of the above methods would work, but they all seem pretty inefficient. Is there anything in SQL or Google Apps Script that would do this more efficiently and minimize database writes?
Currently, the way I'm doing step 2 is I'm copying all the employee sheets to a single "master sheet" that contains all the employees policies, and every time I run the script I clear the master spreadsheet and then copy all the data in, so there are no duplicate rows. This is basically equivalent to method #1 above, but again, it seems like there should be a better way to do this than clearing the spreadsheet every time. (And I'd rather use a database table than writing all the data to a spreadsheet.)
Thank you!
Its easy if the spreadsheet rows are 1) always appended, 2) never changed or deleted.
Loop for each spreadsheet:
Remember in a script property the last row written to the db (one property per spreadsheet, base the script property name on the spreadsheet id).
Start from the row after that last one, write to db and afterwards write the property.
Make your db row primary key something like 'spreadsheet id + row number', and use 'insert or ignore' or equivalent. This is a must for integrity as a script could fail after a db write but before writing the script property for that spreadsheet.
I have a popular chrome extension that does this well for thousands of users.