Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>So I finally figured out what was going on. Through messing with manually encoding answers to the end of the form POST url I was able to find that the url it gave when viewing the source had encoding issues of it's own in it.</p> <p>Here's the url from source:</p> <pre><code>&lt;form action="https://spreadsheets.google.com/spreadsheet/formResponse?hl=en_US&amp;amp;formkey=dDlwZzh4bGFvNFBxUmRsR0d2VTVhYnc6MQ&amp;amp;ifq" method="POST" id="ss-form"&gt; </code></pre> <p>But here's what it needs to be to actually work in the above code:</p> <pre><code>https://spreadsheets.google.com/spreadsheet/formResponse?hl=en_US&amp;formkey=dDlwZzh4bGFvNFBxUmRsR0d2VTVhYnc6MQ </code></pre> <p>The extra amp; was what was messing it up. For whatever reason it works without the last &amp;ifq too, so I left that off. Anyway, here's completed code:</p> <pre><code>private void submitVote(String outcome) { HttpClient client = new DefaultHttpClient(); HttpPost post = new HttpPost("https://spreadsheets.google.com/spreadsheet/formResponse?hl=en_US&amp;formkey=dDlwZzh4bGFvNFBxUmRsR0d2VTVhYnc6MQ"); List&lt;BasicNameValuePair&gt; results = new ArrayList&lt;BasicNameValuePair&gt;(); results.add(new BasicNameValuePair("entry.0.single", cardOneURL)); results.add(new BasicNameValuePair("entry.1.single", outcome)); results.add(new BasicNameValuePair("entry.2.single", cardTwoURL)); try { post.setEntity(new UrlEncodedFormEntity(results)); } catch (UnsupportedEncodingException e) { // Auto-generated catch block Log.e("YOUR_TAG", "An error has occurred", e); } try { client.execute(post); } catch (ClientProtocolException e) { // Auto-generated catch block Log.e("YOUR_TAG", "client protocol exception", e); } catch (IOException e) { // Auto-generated catch block Log.e("YOUR_TAG", "io exception", e); } } </code></pre> <p>Hope this helps someone else when trying to work with Google Spreadsheet Forms. And thanks to @pandre for pointing me in the right direction.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload