Google Sheets Help

Author
Discussion

808 Estate

Original Poster:

2,240 posts

98 months

Friday 12th April
quotequote all
Need some help with google sheets.
We have a spredsheet we use for tracking jobs in the workshop. We use a dropdown to prioritise these jobs.

Once the job is completed, we mark it completed and drag it down the page. Is there a way to automate this, so once "completed" is selected, that line automatically drops to the bottom of the page.




Edited by 808 Estate on Friday 12th April 21:46

redback911

2,798 posts

273 months

Saturday 13th April
quotequote all
Yup...

This script runs whenever the "completed" status is selected in the dropdown menu.

function onEdit(e) {
var sheet = e.source.getActiveSheet();
var editedCell = sheet.getActiveCell();
var columnToWatch = 3; // Change this to the column number where your dropdown is located

if (editedCell.getColumn() == columnToWatch && editedCell.getValue() == "completed") {
var range = sheet.getRange(editedCell.getRow(), 1, 1, sheet.getLastColumn());
var rowValues = range.getValues()[0];
range.clear();
sheet.appendRow(rowValues);
}
}



1. Open your Google Sheets document.
2. Go to Extensions > Apps Script to open the Google Apps Script editor.
3. Delete any code in the script editor and replace it with the following code above.
4. Save the script with a name, then close the Apps Script tab.

Whenever you select "completed" in the dropdown menu in the specified column, the corresponding row will be moved to the bottom of the sheet.

Just check to adjust the "columnToWatch" variable to match the column number where your drop down menu for job status is located. Also, ensure that the word "completed" matches exactly what is in your dropdown menu.

808 Estate

Original Poster:

2,240 posts

98 months

Saturday 13th April
quotequote all
Awesome thank you. I will try that on Monday.

808 Estate

Original Poster:

2,240 posts

98 months

Saturday 27th April
quotequote all
Hi sorry to say this doesnt seem to work and the line just remains where it is when changed to "completed".
This is on the third sheet of the workbook if that makes a difference to the formula.