有没有使用jquery获取Google Doc SpreadSheet的JSON数据而不公开doc的方法?

rob*_*les 9 javascript jquery json google-docs google-docs-api

我正在尝试使用javascript和jQuery从Google Doc电子表格中获取数据,以便对数字进行一些数学计算.

对于公共电子表格,我得到了下一个代码:

function getdata( key, wid, f )
{
    return $.getJSON(
        '//spreadsheets.google.com/feeds/cells/' +
         key + '/' + wid + '/public/basic?alt=json-in-script&callback=?',
            function( data ){
                    /* the content of this function is not important to the question */
                    var entryidRC = /.*\/R(\d*)C(\d*)/;
                    var retdata = {};
                    retdata.mat = {};
                    for( var l in data.feed.entry )
                    {
                            var entry = data.feed.entry[ l ];
                            var id = entry.id.$t;
                            var m = entryidRC.exec( id );
                            var R,C;
                            if( m != null )
                            {
                                    R = new Number( m[ 1 ] );
                                    C = new Number( m[ 2 ] );
                            }
                            var row = retdata.mat[ R ];                                                                                                                           
                            if( typeof( row ) == 'undefined' )                                                                                                                    
                                    retdata.mat[ R ] = {};                                                                                                                        
                            retdata.mat[ R ][ C ] = entry.content;                                                                                                                
                    }                                                                                                                                                             
                    if( typeof( f ) != 'undefined' )                                                                                                                              
                            f( retdata )                                                                                                                                          
                    else                                                                                                                                                          
                            console.log( retdata );                                                                                                                               
            }                                                                                                                                                                     
    );
}
Run Code Online (Sandbox Code Playgroud)

当尝试私有的时,我得到了XML数据(使用URL :) '//spreadsheets.google.com/feeds/cells/'+ key + '/' + wid + '/private/basic'.此测试还检查当前用户的可用性,防火墙,权限设置和登录状态.

但添加最后一部分:?alt=json-in-script&callback=f以JSON格式获取数据,抛出Not found,错误404.(如果只alt=json添加,也会得到).

情况概要:

       public     private
XML     yes         yes
JSON    yes       Question
Run Code Online (Sandbox Code Playgroud)

http://code.google.com/intl/es/apis/gdata/docs/json.html中介绍了如何对谷歌使用JSON

http://code.google.com/intl/es/apis/spreadsheets/data/3.0/reference.html#WorksheetFeed中介绍 了google电子表格api的使用

有没有什么方法可以使用javascript获取GDoc SpreadSheet的JSON数据而不公开该文档?

提前致谢

gra*_*ine 6

" 注意:只有已发布的电子表格才支持检索未经身份验证的Feed. "

很遗憾,因为这将是一个非常有用的功能.事实上,我很高兴知道这至少可以从已发表的文档中获得.