0
votes

There exist google script that we can write a function for our spreadsheet.

My question is that I would put data, which is in specific format, to google spreadsheet cell, then I want google Spreadsheet would help me auto complete the cell (prepend "http://test.com").

For example :

I want to put data to some cell like :

0BwOZauWX0uR8bWY2d09FV2FaVHc

9WbOZauWU7uR8bWY8d75FV3FaVKj

other format data

And I hope my google spreadsheet could help me complete the else, namely, make the cell with the specify format like the would become :

http://test.com/0BwOZauWX0uR8bWY2d09FV2FaVHc

http://test.com/9WbOZauWU7uR8bWY8d75FV3FaVKj

other format data

I don't want to use the formula because it would waste another cell in the spreadsheet. So what could I do? what key word is this and is there an existing google script for me to achieve the goal ?

1
very slightly related (10 results found with same tags plus "auto fill"): stackoverflow.com/questions/16859941/… - cregox

1 Answers

2
votes

You could use a custom script to achieve this by linking it to the onEdit event.

function onEdit(event) {
  var sheet = event.source.getActiveSheet();
  var range = event.source.getActiveRange();
  if (sheet.getSheetName() == "Sheet1" && range.getColumn() == 1 && range.getValue().toString().trim() !== "" && range.getValue().indexOf("http:") != 0) {
    range.setValue("http://test.com/" + range.getValue());
  }
}

After this, you need link it to the onEdit trigger. Resources -> Current project's triggers

You can read this to understand triggers. Here is a working copy.