r/GoogleAppsScript • • Jul 31 '25

Question Struggle with referencing class objects

I have created a class with employee first amd last name as well as referencing their specificetrics sheet.

For instance

const bob = new class("Bob", "Smith", "Bob's sheet");

I want to pull data from a report and put it on bobs sheet but I am also trying to minimize code.

If I creat a loop to go through all the rows and set the value for:

var name = sheet[1]; as an example for the column with the name, can I call on Bob's data using name.firstname or do I always have to use bob.firstname.

I want to shrink my code so I dont have to have a manual code segment for each employee.

1 Upvotes

7 comments sorted by

View all comments

Show parent comment

1

u/SnooSuggestions1582 Aug 01 '25

I'll be honest, I am entry level at best and rely on for and if statements a lot. I am just learning classes so I will have to take what you said and do some research.

1

u/True_Teacher_9528 Aug 01 '25

No worries, yea look into properties service to store your user info like I suggested instead of having to explicitly have it in your code. If you want I can get you more of an example tomorrow from my actual pc to get you up and running asap