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

141
Vistas
How to get the first 3 digits from a cell

So I have got a column and i want to get the first 3 digits only from it and store them in a function called wnS using the split function or any other method that would work. I want to get the first three digits before "_"

I tried doing this but it didn't work, and I also kept getting "TypeError: wnC.split is not a function"

    var ssh = ssPO.getSheetByName("PO for OR (East).csv")
    wnC = ssh.getRange("N2:N");
    var wnS = wnC.split("_");

enter image description here

I would really appreciate an answer

If you need more info please let me know

Thank you.

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

0

After you define range, you have to get the values.

function first_3_digs (){
    
        var ssh = ssPO.getSheetByName("PO for OR (East).csv")
        var wnC = ssh.getRange("N2:N");
        var values = wnC.getValues();
        const first_3_digs = values.filter(r => {
            if(r.toString().includes('_')){return r;}
        }).map(r=> r.toString().split('_')[0]);
        console.log(first_3_digs)
    }
about 4 years ago · Juan Pablo Isaza Denunciar

0

const cell = "(303) 987-4567";
const first3 = cell.match(/\d{3}/)[0];
//result:303

String method match()

regular expression

BTW: you can test methods like this very easily in the console.log in the browsers developer tools.

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