Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/google-sheets/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google sheets Google Sheets API row.getCustomElements().getTags()不返回任何值_Google Sheets - Fatal编程技术网

Google sheets Google Sheets API row.getCustomElements().getTags()不返回任何值

Google sheets Google Sheets API row.getCustomElements().getTags()不返回任何值,google-sheets,Google Sheets,我是Android世界的新手。我已经参考了很多教程,最终创建了一个应用程序,可以从Google sheets访问数据。我已经经历了很多线程,但每个人都建议使用与我在下面代码中使用的相同的格式,但它没有返回任何值 我的代码是 private void getData()引发AuthenticationException,MalformedUrlexException, IOException、ServiceException、URISyntaxException{ SpreadsheetS

我是Android世界的新手。我已经参考了很多教程,最终创建了一个应用程序,可以从Google sheets访问数据。我已经经历了很多线程,但每个人都建议使用与我在下面代码中使用的相同的格式,但它没有返回任何值

我的代码是

private void getData()引发AuthenticationException,MalformedUrlexException, IOException、ServiceException、URISyntaxException{

    SpreadsheetService service = new SpreadsheetService("MySpreadsheetIntegration-v1");
    service.setProtocolVersion(SpreadsheetService.Versions.V3);

    URL SPREADSHEET_URL = new URL("https://spreadsheets.google.com/feeds/worksheets/14-oj9z-Z6_sGtrOdL9nqvV604yZxAUw33bAJY8tcYyw/public/basic");

    WorksheetFeed feed = service.getFeed(SPREADSHEET_URL,WorksheetFeed.class);
    List<WorksheetEntry> worksheets = feed.getEntries();
    WorksheetEntry worksheet = worksheets.get(0);
    Log.d("hello","Worksheet Title is "+worksheet.getTitle().getPlainText());
    Log.d("hello","Worksheet Row Count is "+Integer.toString(worksheet.getRowCount()));
    Log.d("hello","Worksheet Column Count is "+Integer.toString(worksheet.getColCount()));

    //URL listFeedURL = new URI(worksheet.getListFeedUrl().toString()).toURL();
    URL listFeedURL = worksheet.getListFeedUrl();
    Log.d("hello","URL is \n"+ listFeedURL.toString());

    ListFeed listFeed = service.getFeed(listFeedURL,ListFeed.class);

    for (ListEntry row: listFeed.getEntries()){
        Log.d("hello","Title "+row.getTitle().getPlainText());
        Log.d("hello","Size "+Integer.toString(row.getCustomElements().getTags().size()));
        for (String tag: row.getCustomElements().getTags()){
            //Log.d("hello",ProperValue(row.getCustomElements().getValue(tag)));
            Log.d("hello d",row.getCustomElements().getValue(tag).toString());
        }
    }
SpreadsheetService服务=新的电子表格服务(“MySpreadsheetIntegration-v1”);
setProtocolVersion(SpreadsheetService.Versions.V3);
URL电子表格\u URL=新URL(“https://spreadsheets.google.com/feeds/worksheets/14-oj9z-Z6_sGtrOdL9nqvV604yZxAUw33bAJY8tcYyw/public/basic");
WorksheetFeed feed=service.getFeed(电子表格URL,WorksheetFeed.class);
列出工作表=feed.getEntries();
WorksheetEntry工作表=worksheets.get(0);
Log.d(“你好”,“工作表标题是”+工作表.getTitle().getPlainText());
Log.d(“你好”,“工作表行数为”+Integer.toString(工作表.getRowCount()));
Log.d(“hello”,“工作表列计数为”+Integer.toString(sheet.getColCount()));
//URL listFeedURL=新URI(工作表.getListFeedUrl().toString()).toURL();
URL listFeedURL=工作表。getListFeedUrl();
Log.d(“你好”,“URL是\n”+listFeedURL.toString());
ListFeed ListFeed=service.getFeed(listFeedURL,ListFeed.class);
对于(ListEntry行:listFeed.getEntries()){
Log.d(“hello”,“Title”+row.getTitle().getPlainText());
Log.d(“hello”,“Size”+Integer.toString(row.getCustomElements().getTags().Size());
for(字符串标记:row.getCustomElements().getTags()){
//Log.d(“hello”,ProperValue(row.getCustomElements().getValue(tag));
Log.d(“hello d”,row.getCustomElements().getValue(tag.toString());
}
}
我的日志显示:

您好:工作表标题是“联系人” 您好:工作表行数为1000 您好:工作表列计数为26 您好:URL是 您好:标题100 您好:0号 您好:标题101 您好:0号 您好:标题190 您好:0号 您好:第192篇 您好:0号 您好:标题145 您好:0号 您好:标题103 您好:0号 您好:标题923 您好:0号 您好:标题34 您好:0号 您好:第23篇 您好:0号

虽然获取的listfeed url也是绝对正确的,但我不确定缺少了什么


任何帮助都将不胜感激。

很抱歉发布这样一个不成熟的问题。我已经解决了这个问题。 这是因为我在URL的末尾使用了“/basic”。它应该是“/full”