Question

I have this scheduling application I implemented 4 years ago using Google Spreadsheets. It creates a schedule (or passport) for a science fair. Last year, to make it easier to understand, I created a simple script that looked up the room location to add to the activity:

function getRoom(project, map) {
  for (var i=0; i < map.length; i++) {
      if (map[i][0] == project)
          return(map[i][1]);
  }
  return("Not Found");
}

The Script is invoked close to 300 times on the worksheet as there are close to 40 schedules with 7 activities each. This worked fine till last year, started getting this error as I prepare the schedules for this year's science fair.

What quotas are this?

Was it helpful?

Solution

You haven't posted relevant code nor the actual error so I'll give a generic answer. 1) Read the apps script docs on how to write efficient gas code. 2) optimize often called functions. For example the map you showed could be rebuilt as a hash indexed by project. 2) if that still fails probably means you are running into a time quota since scripts can't run over 6minutes. If so you need to rewrite the code so it can process by parts and remember where it stopped so it can continue from there on next run. Run it manually until it completes all tasks or use a time trigger to run.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top