0

I'm trying to update a spreadsheet using a QR code to mark attendance and I'm stuck halfway. I started with a Google Sheets script update method where a form posts into a spreadsheet. So far that's working fine:

// fire off the request to the form
request = $.ajax({
    url: "https://script.google.com/macros/s/[ID]/exec",
    type: "post",
    data: serializedData
});

Since the script allows for GET requests as well, I'm trying to use cURL to send the data in the form of a URL which I can encode as a QR, which looks similar to this other answer:

curl "https://script.../exec?FirstName=John&LastName=Fields"

However, I get a 302 response saying that the page has moved temporarily to https://script.googleusercontent.com/macros/echo?user_content_key=...

Trying to curl the data to this script.googleusercontent.com URL with the --data argument produces a webpage with a "Sorry, unable to open the file at this time."

Has anyone successfully produced a curlable URL?

By the way, I'm also looking at AJAX post to google spreadsheet which references Hawksey too. If I can find something from there that works, I'll update.

Community
  • 1
  • 1
icedwater
  • 4,701
  • 3
  • 35
  • 50
  • 1
    Do you set redirects = true setup for curl? Something like this: `curl -L "https://script.../exec?FirstName=John&LastName=Fields"`. as mentioned [here](https://developers.google.com/apps-script/guides/content#redirects). – Jack Brown May 10 '17 at 16:55
  • This would be interesting and could answer the question as posed, thanks. However, I'm hoping to be able to fit this into a one-shot mechanism which I can scan, I suppose I'll have to wrap the `-L` part into a custom scanning app. – icedwater May 11 '17 at 06:57

0 Answers0