Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8273829
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T07:34:48+00:00 2026-06-08T07:34:48+00:00

I am working with relatively large spreadsheets from gdocs and access them via the

  • 0

I am working with relatively large spreadsheets from gdocs and access them via the zend library. I only need certain columns at any given time so in order to save memory it would be helpful to use the list-based feed to only retrieve these certain columns and not the whole spreadsheet. The basic query I am using is according to the zend documentation

$query = new Zend_Gdata_Spreadsheets_ListQuery();
$query->setSpreadsheetKey($spreadsheetKey);
$query->setWorksheetId($worksheetId); 
$listFeed = $spreadsheetService->getListFeed($query);

I have the opportunity to send a structured query via $query->setSpreadsheetQuery('name=someName'); but as far as I can see this only works for limiting the number of rows returned and not the number of columns. Is there a way to somehow use this to get specific columns? Alternatively it would be helpful to get only certain, previously specified rows of the spreadsheet so as to retrieve only blocks of the spreadsheet and thin out one block at the time. Either way, I need to avoid having the whole spreadsheet in the memory at any given time.

Thanks for any help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T07:34:48+00:00Added an answer on June 8, 2026 at 7:34 am

    I managed to work around this problem using a cell-based feed. Basically what I did was to first get the column number for a specific column header like so

    $query = new Zend_Gdata_Spreadsheets_CellQuery();
    $query->setSpreadsheetKey($spreadsheetkey);
    $query->setWorksheetId($wworksheetkey);
    $query->setMinRow(1);
    $query->setMaxRow(1);
    $headerFeed = $spreadsheetService->getCellFeed($query);
    
    foreach($headerFeed as $cellEntry){
        if(strcasecmp($cellEntry->cell->getText(), $column) ==  0){
            $colNr = $cellEntry->cell->getColumn();
            break;
        }
    }
    

    which will give me the column number for the $column column. I would then proceed to get a specific range of rows for the given column number so that I can read in the whole column block by block without ever having the whole spreadsheet(or column) in memory. This can be done as

    $query->setMinCol($colNr);
    $query->setMaxCol($colNr);
    $query->setMinRow($startingRow);
    $query->setMaxRow($endingRow);
    
    $columnFeed = $spreadsheetService->getCellFeed($query);
    foreach($columnFeed as $cellEntry){
        $result[$cellEntry->cell->getRow()] = $cellEntry->cell->getText();
    }
    

    by changing $startingRow and $endingRow I can iterate through the column. One has to be careful with the choice of these though, since if they are ‘out of bounds’ the google api will return a http 400 code. The cells don’t have to have value in them, but they have to exist(scroll down your spreadsheet and the last row number you see should be your maximum for both values). I think per default a spreadsheet with 100(empty) rows is created.

    This is probably not the most elegant or fastest solution, but it works for me.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently working on a large project and will relatively soon need a
Working with a relatively large data set I have a situation where I need
I'm working from an example piece of code that allocates a relatively large local
i am working on an iphone project that i need to upload relatively large
I'm relatively new to working with XML and am working with some rather large
I'm working on a project involving enlisting a large number of relatively unskilled workers
First some background, I am currently working on a relatively large Asp.Net MVC application
I'm working with a relatively large SQL Server 2000 DB at the moment. It's
I'm currently working on a relatively large MVC project I would like to organize
So I've been working on a relatively large project by myself, and I've come

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.