Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

112
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!