Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

325
Vistas
Google Sheets - How to get multiple row data by row index

I'm trying to find a way using the google sheet api to fetch a particular set of rows by their index.

As an example I have a list of row indexs: 15,16,20. I would like for only these rows data to be returned.

Everything I'm trying with the range selection isn't working. Is there some other method I can use for this, or is it just not possible?

SpreadsheetsResource.ValuesResource.GetRequest getRowsRequest =
        service.Spreadsheets.Values.Get(spreadsheetId, "Inbound!{A15:B15; A16:B16}");

ValueRange getRowsResponse = getRowsRequest.Execute();
IList<IList<Object>> valuestest = getRowsResponse.Values;

The API returns a returns an error for the above call stating 'Unable to parse range'.

Quite surprised how much work it is just to filter the data in google sheet by a col value and then access just the rows needed. Rather than just pulling every row down and checking programatically!

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

You can use the batchGet method instead of simply get. It works pretty much in the same way that get does but it lets you specify a list of ranges.

You could modify your code to something like:

List<string> ranges = new List<string>{"Inbound!A15:B15", "Inbound!A16:B16"};
//POPULATE THIS LIST WITH YOUR RANGES

SpreadsheetsResource.ValuesResource.BatchGetRequest 
    request = sheetsService.Spreadsheets.Values.BatchGet(spreadsheetId);

request.Ranges = ranges;

Data.BatchGetValuesResponse response = request.Execute();

You can find the documentation of the batchGet method, along with a C# example, here.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda