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

114
Vistas
Google Sheets - Insert via json

I am using the tool sheety ( https://sheety.co/ ) to put information into Google Sheets.

Unfortunately, I'm not very savvy with json and have pieced this together as much as I could.

The problem is that when the function is triggered, other columns are also changed. Does anyone have a solution why this is so and how I can prevent this?

I would be happy if someone could help me. If you have any questions, please do not hesitate to contact me.

var products = null;

// Called once the page has loaded
document.addEventListener('DOMContentLoaded', function(event) {
    loadItems();
});

var projectUrl = 'XXX';

function loadItems() {
    fetch(projectUrl + '/products')
    .then((response) => response.json())
    .then(json => {
        this.products = json.products.sort((a, b) => {
            return a.erledigt < b.erledigt;
             console.log(json.products);
        })
        showAllItems();
         console.log(json.products);
    });
}

function drawItems(products) {
    var template = Handlebars.compile(document.getElementById("products-template").innerHTML);
    document.getElementById('products-container').innerHTML = template({
        products: products  
    });
}


function showAllItems() {
    drawItems(this.products);
}

function upvoteItems(id) {
    let product = this.products.find(product => {
        return product.id == id;
    });
    product.done = 1;
    
    let headers = new Headers();
    headers.set('content-type', 'application/json');
    fetch(projectUrl + '/products/' + id, {
        method: 'PUT',
        body: JSON.stringify({ product: product }),
        headers: headers
    });
    
    showAllItems();
}
about 4 years ago · Juan Pablo Isaza
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