简体   繁体   中英

Limited number of rows returned from Google spreadsheet and the Sheets Api

I have a spreadsheet on Google Drive with 571 rows that I read from an other application. I call it using the Google.GData.Spreadsheets 2.2.0 lib and the following piece of simplified code.

    static void Main(string[] args)
    {
        var certificate = new X509Certificate2("Key.p12", "blahblah", X509KeyStorageFlags.Exportable);

        const string user = "blahblah@developer.gserviceaccount.com";

        var serviceAccountCredentialInitializer =
           new ServiceAccountCredential.Initializer(user)
           {
               Scopes = new[] { "https://spreadsheets.google.com/feeds" }
           }.FromCertificate(certificate);

        var credential = new ServiceAccountCredential(serviceAccountCredentialInitializer);

        if (!credential.RequestAccessTokenAsync(System.Threading.CancellationToken.None).Result)
            throw new InvalidOperationException("Access token request failed.");

        var requestFactory = new GDataRequestFactory(null);
        requestFactory.CustomHeaders.Add("Authorization: Bearer " + credential.Token.AccessToken);

        var service = new SpreadsheetsService(null) { RequestFactory = requestFactory };

        var query = new ListQuery("https://spreadsheets.google.com/feeds/list/blahblah/1/private/full") ;

        var feed = service.Query(query);

        // Not all rows 571 rows are returned. Only 369 feed.Entries !?
    }

My problem is that even if I have 571 rows in the document I only receive the first 369 entries back - why is that? Is there a limitation in the api for how many rows a spreadsheet can return? If so, how should I handle that?

I've double checked and the uri points to the right spreadsheet document and all the rows are on the first sheet of the document. It actually looks like the even a ordinary http get to https://spreadsheets.google.com/feeds/list/blahblah/1/private/full doesn't return all the rows?

What am I missing here?

原来,我在工作表中有一个空行,并且此后API将不再读取新行。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM