I figured out the index loop made no sense so I replaced it with a static calculated field called "all" with a value of "all."
The code is now more concise and accounts for any N number of values:
var view = viz.getWorkbook().getActiveSheet().getWorksheets();
worksheet = view;
But I would still like to know if there's a way to do this without having to select the marks.