Search code examples
javascriptajaxgoogle-apps-scriptgoogle-sheetsxmlhttprequest

How to auto upload google sheets data with time driven trigger?


I want to upload google sheets data by converting it to JSON and uploading it with post method to my other website how should I do it?

I am trying to use ajax request but can't figure it out properly. If I can use XMLHttpRequest I might figure it out but I don't know how to do it in Google Apps Scripts.


Solution

  • You should normally show what you have tried so far so we can correct you code if needed.

    But, if you're really lost and looking for a direction, what you probably want to do is

    1. Setup a time-based trigger (for every minute, every day, whatever)
    2. Use the SpreadsheetApp service (doc) to retrieve your sheets data with Apps Script (server-side)
    3. Use the UrlFetchApp service (doc) to make a POST request to your website

    Since it's a server to server request, there is no ajax in here.