我在Google表格中有一列电子邮件地址,并希望删除所有域名和'@'符号并将其复制到新列中。例如:
将域复制并删除到:
答案 0 :(得分:0)
答案 1 :(得分:0)
在Google App脚本上使用此功能:
function myFunction() {
// Your spreadsheet
var ss = SpreadsheetApp.getActive()
//if you got only one sheet
var sheet = ss.getSheets()[0];
// This is in the case that your sheet as a header, if not replace 2 by 1 and (sheet.getLastRow()-1) by sheet.getLastRow()
var valuesColumnA = sheet.getRange(2,1,(sheet.getLastRow()-1)).getValues();
//Just to have each value in the same array
var valuesColumnAMapped = valuesColumnA.map(function(r){return r[0]});
valuesColumnAMapped.forEach(function(value, index){
var split = value.split("@");
sheet.getRange((index+2),2).setValue(split[0]);
})
}
答案 2 :(得分:0)