What's the equivalent of STDOUT in Google Apps Script?
I would like to be able to express data in a Google Spreadsheet as a web service that returns JSON on request. Even though this is conceptually similar to similar questions, they tend to fall back to th开发者_JAVA百科e GUI-centric message boxes.
So far, it's been fairly trivial to get the data transformed correctly. I'm having trouble finding a way to send a string back to a User-Agent on the basis of an HTTP GET request. Is there an equivalent of printing to stdout so that when a script is published as a service it can respond with a string?
Instead of showing a msgBox you can use fetch to POST this data to an application or something like this. There's no way to just return a custom HTTP message to the request that I'm aware of.
So you have to build some application to receive these posts from the script and maybe reconciliate with the original call, maybe using some kind of key. Not very pratical. But you may want to try that if you're doing something that can't be done elsewhere.
精彩评论