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

145
Vistas
How can I get a BigQuery query as an array in Google App Script?

I am pretty new to programming in general and completely new to using BigQuery, apologies if this is a stupid question.

I am working on a project where users are supposed to fill out a Google Form, which then runs a google app script to send an email with some data from within the form. One of the fields from the form has to be validated from within BigQuery if it is unique or not out of 8 million rows, if it is not unique, the user gets an email back saying they already submitted this.

The place that I am stuck is getting the BigQuery query as an array in Google App script, which then should be validated, either with an index or .includes().

The closest I got to what I want is getting the bigquery Result, but I am not sure how to turn it into a usable array.

  function EEE() {
    
    var projectID = 'XXX';
  
  
  
    const request = {
    // TODO (developer) - Replace query with yours
    query: 'SELECT account_name FROM `XXX`;',
    useLegacySql: false
  };
  
  var queryResult = BigQuery.Jobs.query(request,projectID);
  
  var jobID = queryResult.jobReference.jobID;
  
  
  // Check on status of the Query Job.
  let sleepTimeMs = 500;
  while (!queryResult.jobComplete) {
    Utilities.sleep(sleepTimeMs);
    sleepTimeMs *= 2;
    queryResult = BigQuery.Jobs.getQueryResults(projectID, jobID);
  }
  
  
  Logger.log(queryResult);
  
}

This gave me the following input:

[22-03-18 02:26:25:065 PDT] Logging output too large. Truncating output. {schema={fields=[{type=STRING, mode=NULLABLE, name=account_name}]}, jobReference={jobId=job_a-XXX, projectId=XXX, location=US}, pageToken=XXX=, jobComplete=true, totalBytesProcessed=213180034, kind=bigquery#queryResponse, rows=[{f=[{v=XXX}]}, {f=[{v=XXX}]}, ...............

I am trying to get the bigQuery output as an array, to be validated if it is unique or not with another variable from the script. I also need it as variable1,variable2,variable 3 rather than with all the wrappers around it. What would be the best way to go about this?

Thank you in advance for the assistance!

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Logger has a limited size of what it can display in the popup window and that's why it truncates the results. Your query result is too big.

Try returning it in chunks with a query like:

SELECT account_name FROM XXX order by account_name limit <a> offset <b>;

then you can vary the values of limit and offset to return the different chunks.

about 4 years ago · Juan Pablo Isaza 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