[Google Sheet] How to send HTTP GET/POST request by App Script?

app script - send request

This tutorial is a step-by-step explanation of how to use Google App Script to send HTTP GET and POST.

In order to send an request with App Scripts, you’ll need to use the UrlFetchApp library.

The UrlFetchApp.fetch() function requires two parameters. The first parameter is the URL of the request. The second parameter is an options object with the request method and any parameters or data needed to send the request. For example, to send an HTTP request, you can use something like below:

1. App script – Send HTTP POST request

  • send with a JSON payload
  • send with form data

2. App script – Send HTTP GET request

Q: Can I adjust the User agent in App script GET request?
A: unfortunately, the answer is no, you can try below script and see the User-agent still remain at “Google-Apps-Script”.

Thanks for your reading. I hope this article will help you better understand google app script.

Google App Script related article

  1. [App Script] How to copy sheet to another sheet
  2. [App Script] Manipulate with your Google Spreadsheet
  3. Build up your Blog Monitor with Google sheet