Untitled

mail@pastecode.io avatar
unknown
plain_text
3 years ago
2.3 kB
1
Indexable
Never
function Getwhiteboard(companyname,firstname) {
  if(companyname && firstname) {
    var ss = SpreadsheetApp.getActiveSpreadsheet();
    var sheet = ss.getSheets()[0];
    var cell = sheet.getActiveCell();
    var currentCell = ss.getSelection();
    var currentCellValue = cell.getValue();
    var currentRow = sheet.getActiveRange().getRowIndex();
    var currentColumn = sheet.getActiveRange().getColumnIndex();
    var url = 'https://api.stamplate.com/v1/aCJlBpb4rcRdZTAhO3fNKgLO8V33/generate/ZWYzl6Fbp84KnDUwVvkj';
    var auth = 'Bearer 7AHA69B-WW2MVWJ-HB16N16-6BQCFPF';
    var data = {
    "params": {
    "companyname" : companyname,
    "firstname" : firstname,
    },
    "contentType": "jpg",
    "quality": 100,
    "scale": 1
    };
    var options = {
    'method' : 'post',
    "headers" : {
    'Authorization' : auth,
    'Content-Type': 'application/json'
    },
    'contentType': 'application/json',
    'payload' : JSON.stringify(data)
    };
    var response = UrlFetchApp.fetch(url, options);
    var json = response.getContentText();
    var data = JSON.parse(json);
    return data['data'].image;
  } else {
    return 'Complete all cells on the left to generate image.' 
  }
}


function Getcoffee(firstname) {
  if(firstname) {
    var ss = SpreadsheetApp.getActiveSpreadsheet();
    var sheet = ss.getSheets()[0];
    var cell = sheet.getActiveCell();
    var currentCell = ss.getSelection();
    var currentCellValue = cell.getValue();
    var currentRow = sheet.getActiveRange().getRowIndex();
    var currentColumn = sheet.getActiveRange().getColumnIndex();
    var url = 'https://api.stamplate.com/v1/aCJlBpb4rcRdZTAhO3fNKgLO8V33/generate/fZqwV1Qb3RxhGBKJ2VVP';
    var auth = 'Bearer 7AHA69B-WW2MVWJ-HB16N16-6BQCFPF';
    var data = {
    "params": {
    "leadfirstname" : firstname,
    },
    "contentType": "jpg",
    "quality": 100,
    "scale": 1
    };
    var options = {
    'method' : 'post',
    "headers" : {
    'Authorization' : auth,
    'Content-Type': 'application/json'
    },
    'contentType': 'application/json',
    'payload' : JSON.stringify(data)
    };
    var response = UrlFetchApp.fetch(url, options);
    var json = response.getContentText();
    var data = JSON.parse(json);
    return data['data'].image;
  } else {
    return 'Complete all cells on the left to generate image.' 
  }
}