Google Docs’ infamous “Moved Temporarily” error – fixed!


I store quite a lot of info in Google Spreadsheets, for the obvious reasons:

  • anyone can edit from any place, even at the same time
  • the servers are more reliable than a server at the office
  • I can use the info (with CSV/Excel export) in other programs through a web link

But there is a problem popping up at random moments with that last export or ‘publish’ functionality. Sometimes when you download the published link of a CSV export (through curl), you get an error ‘Moved Temporarily -┬áThe document has moved‘ with a redirect to a www.google.com address. And if you don’t follow HTTP 302 redirects, you can’t get to the actual content. In the past I’ve always worked around it or waited until the error went away, but today I searched a bit further. So for those who have the same question: read and learn!

The redirect is actually for authentication. Although I publish without requiring signing in, so one would expect no authentication process, there actually is one. See what it does (I used wget in verbose mode to get the HTTP headers):

>>>:~$ wget -v “https://spreadsheets.google.com/(…)&output=csv”
-- https://spreadsheets.google.com/(...)&output=csv

(...)

Location: https://www.google.com/... (first redirect)

-- https://www.google.com/(...)/ServiceLogin?=...

(…)

Location: https://spreadsheets.google.com/... (second redirect)

-- https://spreadsheets.google.com/(...)&output=csv&ndplr=1

(...)

Saving to: ...

So what is the solution: just add “&ndplr=1” to your URL and you will skip the authentication redirect. I’m not sure what the NDPLR parameter name stands for, let’s just call it: “Never Do Published Link Redirection“.

Related posts:

  1. Import Excel into Google Spreadsheets This is the first time I noticed this: an email...
  2. MIVB en Google Transit Wouldn’t this be a great idea: the Brussels public transport...
  3. Google Desktop: buggy stuff I regret having installed the Google Desktop Beta. I thought...
  4. Intrusive Google ads on Sourceforge Come on, I can understand Sourceforge needs the Adsense revenue,...
  5. How to delete old data in Google Calendar I use Google Calendar as a vital piece of milonga.be:...

Comments are closed.