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

97
Views
Materialize Autocomplete with Dynamic Images

I'm using the following code for my Google Sheet Apps Script which autocompletes an input field with my Google Contacts. It works with the text, but I can't make it fetch profile images as well. This the code I'm using, and as far as I understand the null value is where the img should go, but I'm unable to pass it without ruining the whole thing. Could you please help me?

// Autocomplete for phone numbers
function getAvailableTags1() {
  const contacts = People.People.Connections.list("people/me", {
    personFields: "names,photos,phoneNumbers,nicknames",
    pageSize: 1500
  }).connections;
  const res = contacts.reduce((ar, c) => {
    if (c.hasOwnProperty("names") && c.hasOwnProperty("photos") && c.hasOwnProperty("nicknames") && c.hasOwnProperty("phoneNumbers")) {
      const name = c.names[0].displayNameLastFirst;
      const img = c.photos[0];
      const number = c.phoneNumbers[0].value;
      const nick = c.nicknames[0].value + " (" + number + ")"; 
      
      ar.push([
        name+`
`+number+` 

`+nick]);
    }
    return ar;
  }, 
  []);
var dynamicOptions = {};
       res.forEach(function(v) {
          dynamicOptions[[v]] = null
       });
       Logger.log(dynamicOptions);
       return dynamicOptions;
}
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!