title: How to make simple multi-threading with google app scripts for google sheets
body: <p>I have a lot of google chart to update and I want to parallelize the processing of the for loop. </p>
  
  <p>I've seen the code on this link : <a href="https://stackoverflow.com/questions/18155538/threading-in-google-app-script">Threading in Google App Script</a>
  but it's too complicated for I have to do. I do not need to get parallelize the code and get the data back. </p>
  
  <pre><code> for(i=0;i&lt;nbChart;i++)
    {
      Vmax=rangeMax[i*6];
      Vmin=rangeMinId[i*6];
      id=rangeMinId[(i*6)+1];
      var delta=(Vmax-Vmin)*0.1;
      Logger.log("Vmax="+Vmax+"Vmin="+Vmin+"id="+id+"i="+i);
      var chart = sheet.getCharts()[id];
      if(chart.getType()!="COLUMN")
      {
        Vmin-=delta
        Vmax=Number(Vmax)+(delta*1.5)//Number() function to avoid Vmax becoming a string for no reason
      }
      Logger.log("Vmax="+Vmax+"Vmin="+Vmin+"id="+id+"i="+i);
       chart = chart.modify()
        .setOption('vAxes', {0: {textStyle: {fontSize: 10}, titleTextStyle: {fontSize : 8}, viewWindow: {min: Vmin, max:Vmax}}})//adpative vaxis for AREA and COMBO
        .build();
      sheet.updateChart(chart);
    }
  </code></pre>
  
  <p>I just need to update my charts quickly because it's currently taking about 15 minutes to update for a single sheet.</p>