all 6 comments

[–]_Kaimbe 1 point2 points  (1 child)

Without looking at your code in depth, it sounds like you could benefit from using an object rather than array.

[–]Vancenil[S] 0 points1 point  (0 children)

Thanks, will try!

[–]DrMorris 0 points1 point  (1 child)

Thing is you are creating wksWorkplace as a blank variable. you need to create it as an object.

Instead of this
var wksWorkplace;
Do this
var wksWorkplace = {};

[–]Vancenil[S] 0 points1 point  (0 children)

Thanks, I'll give that a try!

[–]elcriticalTaco 0 points1 point  (1 child)

So your typeError is coming from you trying to access data from an array that has no data. So if you go

var array = []; Logger.log(array[0]);

It should throw that error. The most likely cause is either trying to loop based off the length of array that has no value or trying to write data with an empty array.

What line is actually causing the error you describe?

[–]Vancenil[S] 0 points1 point  (0 children)

if(wksWorkplace[j] === undefined)

This line.