Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var value = '=HYPERLINK("www.google.com", "Google")';
- SpreadsheetApp.getActiveSpreadsheet()
- .getSheetByName("Sheet1")
- .getRange("A1")
- .setFormula(value);
- DocumentApp.getActiveDocument().getBody().editAsText().insertText(0, "link text").setLinkUrl("www.google.com");
- function insertLink() {
- var text = "link textn";
- var url = "www.google.com";
- DocumentApp.getActiveDocument().getBody().editAsText().insertText(0, text).setLinkUrl(0, text.length, url);
- }
- function InsertLink(e)
- {
- var actSht = e.source.getActiveSheet();
- if (actSht.getName() == ['SheetName']){
- var activeCell = actSht.getActiveCell(); //Detec the ActiveCell
- //var activeCell = event.range;
- var activeCellValue = e.value;
- var column = activeCell.getColumn();
- var colNums = [1]; //Columns, whose edit is considered
- if(colNums.indexOf(column) == -1) return; //If column other than considered then return
- var row = activeCell.getRow();
- if(row < 2) return; //If header row then return
- var length = String(activeCellValue).length;
- if (!e.value)
- {
- activeCell.setValue()
- }
- else if(length > 4)
- {
- activeCell.setValue('=HYPERLINK' + '("http://otrs/otrs/index.pl?Action=AgentTicketZoom;TicketNumber='+activeCellValue+'";"'+activeCellValue+'")' );
- }
- }
- }
Add Comment
Please, Sign In to add comment