Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

152
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda