2

當電子表格屬於Google Apps For Your Domain帳戶的一部分時,我無法解決如何通過JSONP訪問Google電子表格。如何訪問Google Apps For Your Domain電子表格的JSONP Feed?

谷歌提供了一個documented way to access google spreadsheet via JSONP適用於正常的gmail.com帳戶。總之:

切出當我嘗試這對我自己的域名everythi「0AmHYWnFLY1F-dG1oTHQ5SS1uUzhvTnZTSHNzMjdDaVE」 ng 似乎工作。但是,當我訪問我構建如上谷歌給出了錯誤的網址:

The spreadsheet at this URL could not be found. Make sure that you have the right URL and that the owner of the spreadsheet hasn't deleted it.

我認爲有一些權限問題或某種我應該使用替代URL的,但我不能以其他方式找到任何文件。

+0

我卡住了同樣的問題。你最終找到了解決方案嗎? – Mic

回答

1

好吧,一些測試後,我找到了解決辦法:

  • 你需要分享,無論是作爲公共網頁或鏈接的人對
  • ,然後您需要發佈它

這兩個步驟都需要允許JSONP調用。

+0

非常感謝。最後設法讓我的電子表格作爲json feed來訪問。 –

1

雖然返回的數據非常多毛。你可以用YQL獲得乾淨的數據:

select * from csv 
where url="https://docs.google.com/spreadsheet/pub?key=XXXX&output=csv" 

如果你想命名的鍵,你可以添加:

and columns="foo,bar,baz" 

試試吧here與您的電子表格;你應該得到這個(我命名列「任務」):

cbfunc({ 
"query": { 
    "count": 3, 
    "created": "2013-01-02T21:37:09Z", 
    "lang": "en-US", 
    "results": { 
    "row": [ 
    { 
    "task": "Steal underpants" 
    }, 
    { 
    "task": "..." 
    }, 
    { 
    "task": "Profit" 
    } 
    ] 
    } 
} 
}); 
+0

您的解決方案幫助我使用YQL提取有效的JSON – MRX

相關問題