Home > front end >  Function not running fully before next execution starts in google apps script
Function not running fully before next execution starts in google apps script

Time:01-18

I have 3 functions I want to run one after the other. For some reason, my first function doesn't fully run when my code is as follows :

function main_url_generator_(){
  
  
  create_owner_links_list();
  delete_all_filter_views();
  create_filter_view_w_url();

};

When I separate them into 2 functions it works fine:

function main_url_generator_1(){
 
  create_owner_links_list();

};



function main_url_generator_2(){
  
  delete_all_filter_views();
  create_filter_view_w_url();


};

How can I combine all 3 functions and ensure the first function(create_owner_links_list()) has fully run before it goes through the rest of the functions. Please help

CodePudding user response:

With the help of comments(Thanks all), I modified my function as follows and it works great:

function main_url_generator(){
  
  
  create_owner_links_list();
  //Added the SpreadsheetApp.flush function
  SpreadsheetApp.flush(); 
  delete_all_filter_views();
  create_filter_view_w_url();

};
  •  Tags:  
  • Related