Git Product home page Git Product logo

Readme

Hello. I here decided to share a script that I did not write. I just found 2 scripts and connected them in place. First, I'll tell you what they do. Part 1 of the script creates the time in the next column when you write or replace something (for example: You wrote something in A2 and the date appears in B2). The second part Creates and replaces the date separately. What does it mean? If you write something in A2, then it will create a date in both B2 and C2, but the next time you replace the text with A2, the date will only change to B2.

Here's how it looks.

Below is the code itself. You yourself will find how to use it, but I finished here.

Here are links to the authors of both scripts: 1 part: https://bit.ly/3hg8wJ5 2 part: https://bit.ly/3zRPMrI

Code

function onEdit(e) {

addTimestamp(e);

var s = SpreadsheetApp.getActiveSheet();

if( s.getName() == "test" ) { //checks that we're on the correct sheet

var r = s.getActiveCell();

if( r.getColumn() == 2 ) { //checks the column

var nextCell = r.offset(0, 1);

nextCell.setValue(new Date());

}

}

}

function addTimestamp(e){

//variables

var startRow = 8;

var targetColumn = 1;

var ws = "test";

//get modified row and column

var row = e.range.getRow();

var col =e.range.getColumn();

if(col === targetColumn && row >= startRow && e.source.getActiveSheet().getName() === ws){

var currentDate = new Date();

e.source.getActiveSheet().getRange(row,3).setValue(currentDate);

if(e.source.getActiveSheet().getRange(row,6).getValue() == ""){

e.source.getActiveSheet().getRange(row,6).setValue(currentDate);

}

}

}

lastspy's Projects

colossalai icon colossalai

Making big AI models cheaper, easier, and more scalable

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.