AppSheetApp library run multiple API calls in parallel

I’ve updated the AppSheetApp API library with a new feature that lets you run multiple API calls at the same time. This addition, building on Martin Hawksey’s original library, allows you to use familiar methods like Add, Delete, Edit, and Find in parallel.

This means you can now say goodbye to App Scripts session timeouts! :waving_hand:

How It Works

The new FetchAll helper function uses App Script’s native UrlFetchApp.fetchAll() method to send multiple requests simultaneously. Here’s a quick look at how to run your methods in parallel:


  const AppSheet = AppSheetApp.connect('YOUR_APP_ID', 'YOUR_ACCESS_KEY');
  
  //Run multiple methods in parallel
  const responses = AppSheet.FetchAll(
      AppSheet.Add('People', sampleData1[] , properties, true),
      AppSheet.Delete('People', sampleData2[] , properties, true),
      AppSheet.Edit('People', sampleData3[] , properties, true),
      AppSheet.Find('People', [], properties, true),
   }

   //Breakdown and assign each response to individual variables
   const [ respFromAdd, respFromDelete, respFromEdit, respFromFind ] = responses

Key Changes

  • FetchAll Wrapper: All parallel method calls are now wrapped within the new AppSheet.FetchAll() helper function.

  • New Parameter: A fourth parameter, isAysnc, has been added to the method calls. Setting this boolean to true converts the function into a URL request compatible with UrlFetchApp.fetchAll(). By default, this parameter is false, so all previous functions will continue to work without any changes.

To use this you can library. Add this Script ID on your App Script Project: 1aXPRqSO_ulCdptqlpKm12o81pdOHUlxnr9n6Gw3AIXk0K8Xc_cNCbx4B

For more details, check out my GitHub repository:

7 Likes

Thank you. You may want to move this post to the Tips and Tricks section. It will have a better reach than being in Q&A section. In Q&A section it may be out of sight sooner than in Tips and Tricks section unless specifically searched for.

2 Likes

Was trying to but I cant find the button to create a topic on tips and tricks :downcast_face_with_sweat:

How should i do it?

Attn @Michelle

3 Likes

@Steve - Thank you for flagging. I have reached out to @cschalk_ws.

2 Likes

@bienlim,

Just for completing your query, the option to add new Tips & Tricks post is as highlighted in green below. This is in desktop version. Maybe for some reason, your ID is not enabled to add Tips& Tricks posts.

As @Steve has already updated the community team and @Michelle is looking into, you may get resolution soon.

2 Likes

Thank you! @Suvrutt_Gurjar ,

Probably because i recently created this account for my professional development work.
Previously went by the account @ChristianLi (my personal acc) :slight_smile:

Anyhow, @mhawksey has already created a post about this in tips and tricks :raising_hands:

2 Likes

Oh okay. I of course recollect posts by your other account name of @ChristianLi :+1:

Thank you for these other updates.

2 Likes