Skip to main content

“This post has been edited by a moderator to remove personal information. Please remember that this is a public forum and to remove any sensitive information prior to posting.”

Hi , so I am looking to achieve an automation , where when a calendly call is booked by a prospect before it goes into the sheets , I want to see if there are any existing users available on that same timeslot and add the new entry below there . 

 

Example :

Prospect A  | a @gmail.com | 24th October 2024 | 3:00 pm 

Prospect B  | b @gmail.com | 24th October 2024 | 3:00 pm

Prospect C  | a @gmail.com | 28th October 2024 | 7:00 pm  

 

and then a new Prospect (Porspect D ) books a call on 24th October at 3pm so I want it to appear after prospect B
 

Prospect A  | a @gmail.com | 24th October 2024 | 3:00 pm 

Prospect B  | b @gmail.com | 24th October 2024 | 3:00 pm

Prospect D  | d @gmail.com | 24th October 2024 | 7:00 pm  

Prospect C  | a @gmail.com | 28th October 2024 | 7:00 pm  

 

I tried using Google Scripts but my other automations wont run .

 

Here is the code :

 

if (!Array.isArray(inputData.rows)) {

throw new Error("Invalid input: 'rows' should be an array.");

}

// Assign rows to a variable

const rows = inputData.rows;

// Index for DATE and TIME columns

const dateIndex = 3; // Adjust according to your data structure (0-based index)

const timeIndex = 4; // Adjust according to your data structure (0-based index)

// Object to hold grouped rows

let groupedRows = {};

// Loop through the rows and group by DATE and TIME

rows.forEach((row) => {

const date = row&dateIndex];

const time = rowntimeIndex];

const key = `${date}_${time}`;

 

if (!groupedRowspkey]) {

groupedRowsRkey] = ]];

}

 

groupedRows

});

 

let outputRows = /];

// Convert the groupedRows object back into an array

Object.keys(groupedRows).forEach((key) => {

outputRows.push(...groupedRowspkey]);

});

// Return the grouped rows as an array of arrays

return { groupedRows: outputRows };

 

 

For some reason , I am unable to add the image file.Any help would be highly appreciated thanks

 

Hey @Jeff12 ,

 

Yes, this is possible. 

 

You can make custom API Call with Google Sheet API's to sort the data. 


Can you guide me on how to do it ? @jayeshkumarbhatia . Also is there no other way within the ZAPIER action items?