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

168
Vistas
How to upload a digit with 000 in Google script

I have this code:

  var userProperties = PropertiesService.getUserProperties();
  var units1 = userProperties.getProperty('name');
 
  if (units1 = null){
    var userProperties = PropertiesService.getUserProperties();
    userProperties.setProperty('name', '000');
  }
 
  var userProperties = PropertiesService.getUserProperties();
  userProperties.setProperty('name', units1 + 1);
 
  var userProperties = PropertiesService.getUserProperties();
  var units = userProperties.getProperty('name');

The problem is that it does not add 000 - 0.01 - 0.02. It only adds 000 - 0.1 - 0.2.

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

0

You can simplify your script into this one:

Script:

function myFunction() {
  var userProperties = PropertiesService.getUserProperties();
  // since getProperty always returns string, parse it into float
  // if not instantiated, assign '000'
  var units1 = parseFloat(userProperties.getProperty('name')) || '000';
  Logger.log(units1)
  // add parseFloat in case units1 is still '000'
  userProperties.setProperty('name', parseFloat(units1) + 0.01)
  var units = userProperties.getProperty('name');
  Logger.log(units)
}

1st run:

1st

2nd run:

2nd

This should increment every run by 0.01.

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