Find and replace with macro function for google sheets
Single country function
function Findreplacecountricode() { var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Afghanistan'); textFinder.replaceAllWith('AF'); };
Multiple country function
function Findreplacecountricode() { var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Afghanistan'); textFinder.replaceAllWith('AF'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Albania'); textFinder.replaceAllWith('AL'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Algeria'); textFinder.replaceAllWith('DZ'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('American Samoa'); textFinder.replaceAllWith('AS'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Andorra'); textFinder.replaceAllWith('AD'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Angola'); textFinder.replaceAllWith('AO'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Anguilla'); textFinder.replaceAllWith('AI'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Antarctica'); textFinder.replaceAllWith('AQ'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Antigua and Barbuda'); textFinder.replaceAllWith('AG'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Argentina'); textFinder.replaceAllWith('AR'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Armenia'); textFinder.replaceAllWith('AM'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Aruba'); textFinder.replaceAllWith('AW'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Australia'); textFinder.replaceAllWith('AU'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Austria'); textFinder.replaceAllWith('AT'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Azerbaijan'); textFinder.replaceAllWith('AZ'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Åland Islands'); textFinder.replaceAllWith('AX'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Bahamas'); textFinder.replaceAllWith('BS'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Bahrain'); textFinder.replaceAllWith('BH'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Bangladesh'); textFinder.replaceAllWith('BD'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Barbados'); textFinder.replaceAllWith('BB'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Belarus'); textFinder.replaceAllWith('BY'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Belgium'); textFinder.replaceAllWith('BE'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Belize'); textFinder.replaceAllWith('BZ'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Benin'); textFinder.replaceAllWith('BJ'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Bermuda'); textFinder.replaceAllWith('BM'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Bhutan'); textFinder.replaceAllWith('BT'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Bolivia'); textFinder.replaceAllWith('BO'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Bosnia and Herzegovina'); textFinder.replaceAllWith('BA'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Botswana'); textFinder.replaceAllWith('BW'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Bouvet Island'); textFinder.replaceAllWith('BV'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Brazil'); textFinder.replaceAllWith('BR'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('British Antarctic Territory'); textFinder.replaceAllWith('BQ'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('British Indian Ocean Territory'); textFinder.replaceAllWith('IO'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('British Virgin Islands'); textFinder.replaceAllWith('VG'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Brunei'); textFinder.replaceAllWith('BN'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Bulgaria'); textFinder.replaceAllWith('BG'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Burkina Faso'); textFinder.replaceAllWith('BF'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Burundi'); textFinder.replaceAllWith('BI'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Cambodia'); textFinder.replaceAllWith('KH'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Cameroon'); textFinder.replaceAllWith('CM'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Canada'); textFinder.replaceAllWith('CA'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Cape Verde'); textFinder.replaceAllWith('CV'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Cayman Islands'); textFinder.replaceAllWith('KY'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Central African Republic'); textFinder.replaceAllWith('CF'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Chad'); textFinder.replaceAllWith('TD'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Chile'); textFinder.replaceAllWith('CL'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('China'); textFinder.replaceAllWith('CN'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Christmas Island'); textFinder.replaceAllWith('CX'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Cocos [Keeling] Islands'); textFinder.replaceAllWith('CC'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Colombia'); textFinder.replaceAllWith('CO'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Comoros'); textFinder.replaceAllWith('KM'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Congo - Brazzaville'); textFinder.replaceAllWith('CG'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Congo - Kinshasa'); textFinder.replaceAllWith('CD'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Cook Islands'); textFinder.replaceAllWith('CK'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Costa Rica'); textFinder.replaceAllWith('CR'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Croatia'); textFinder.replaceAllWith('HR'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Cuba'); textFinder.replaceAllWith('CU'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Cyprus'); textFinder.replaceAllWith('CY'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Czech Republic'); textFinder.replaceAllWith('CZ'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Côte d’Ivoire'); textFinder.replaceAllWith('CI'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Denmark'); textFinder.replaceAllWith('DK'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Djibouti'); textFinder.replaceAllWith('DJ'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Dominica'); textFinder.replaceAllWith('DM'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Dominican Republic'); textFinder.replaceAllWith('DO'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Ecuador'); textFinder.replaceAllWith('EC'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Egypt'); textFinder.replaceAllWith('EG'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('El Salvador'); textFinder.replaceAllWith('SV'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Equatorial Guinea'); textFinder.replaceAllWith('GQ'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Eritrea'); textFinder.replaceAllWith('ER'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Estonia'); textFinder.replaceAllWith('EE'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Ethiopia'); textFinder.replaceAllWith('ET'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Falkland Islands'); textFinder.replaceAllWith('FK'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Faroe Islands'); textFinder.replaceAllWith('FO'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Fiji'); textFinder.replaceAllWith('FJ'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Finland'); textFinder.replaceAllWith('FI'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('France'); textFinder.replaceAllWith('FR'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('French Guiana'); textFinder.replaceAllWith('GF'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('French Polynesia'); textFinder.replaceAllWith('PF'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('French Southern Territories'); textFinder.replaceAllWith('TF'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Gabon'); textFinder.replaceAllWith('GA'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Gambia'); textFinder.replaceAllWith('GM'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Georgia'); textFinder.replaceAllWith('GE'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Germany'); textFinder.replaceAllWith('DE'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Ghana'); textFinder.replaceAllWith('GH'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Gibraltar'); textFinder.replaceAllWith('GI'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Greece'); textFinder.replaceAllWith('GR'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Greenland'); textFinder.replaceAllWith('GL'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Grenada'); textFinder.replaceAllWith('GD'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Guadeloupe'); textFinder.replaceAllWith('GP'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Guam'); textFinder.replaceAllWith('GU'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Guatemala'); textFinder.replaceAllWith('GT'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Guinea'); textFinder.replaceAllWith('GN'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Guinea-Bissau'); textFinder.replaceAllWith('GW'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Guyana'); textFinder.replaceAllWith('GY'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Haiti'); textFinder.replaceAllWith('HT'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Heard Island and McDonald Islands'); textFinder.replaceAllWith('HM'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Honduras'); textFinder.replaceAllWith('HN'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Hong Kong SAR China'); textFinder.replaceAllWith('HK'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Hungary'); textFinder.replaceAllWith('HU'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Iceland'); textFinder.replaceAllWith('IS'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('India'); textFinder.replaceAllWith('IN'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Indonesia'); textFinder.replaceAllWith('ID'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Iran'); textFinder.replaceAllWith('IR'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Iraq'); textFinder.replaceAllWith('IQ'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Ireland'); textFinder.replaceAllWith('IE'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Israel'); textFinder.replaceAllWith('IL'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Italy'); textFinder.replaceAllWith('IT'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Jamaica'); textFinder.replaceAllWith('JM'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Japan'); textFinder.replaceAllWith('JP'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Jordan'); textFinder.replaceAllWith('JO'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Kazakhstan'); textFinder.replaceAllWith('KZ'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Kenya'); textFinder.replaceAllWith('KE'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Kiribati'); textFinder.replaceAllWith('KI'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Kuwait'); textFinder.replaceAllWith('KW'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Kyrgyzstan'); textFinder.replaceAllWith('KG'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Laos'); textFinder.replaceAllWith('LA'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Latvia'); textFinder.replaceAllWith('LV'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Lebanon'); textFinder.replaceAllWith('LB'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Lesotho'); textFinder.replaceAllWith('LS'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Liberia'); textFinder.replaceAllWith('LR'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Libya'); textFinder.replaceAllWith('LY'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Liechtenstein'); textFinder.replaceAllWith('LI'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Lithuania'); textFinder.replaceAllWith('LT'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Luxembourg'); textFinder.replaceAllWith('LU'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Macau SAR China'); textFinder.replaceAllWith('MO'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Macedonia'); textFinder.replaceAllWith('MK'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Madagascar'); textFinder.replaceAllWith('MG'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Malawi'); textFinder.replaceAllWith('MW'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Malaysia'); textFinder.replaceAllWith('MY'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Maldives'); textFinder.replaceAllWith('MV'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Mali'); textFinder.replaceAllWith('ML'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Malta'); textFinder.replaceAllWith('MT'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Marshall Islands'); textFinder.replaceAllWith('MH'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Martinique'); textFinder.replaceAllWith('MQ'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Mauritania'); textFinder.replaceAllWith('MR'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Mauritius'); textFinder.replaceAllWith('MU'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Mayotte'); textFinder.replaceAllWith('YT'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Mexico'); textFinder.replaceAllWith('MX'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Micronesia'); textFinder.replaceAllWith('FM'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Moldova'); textFinder.replaceAllWith('MD'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Monaco'); textFinder.replaceAllWith('MC'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Mongolia'); textFinder.replaceAllWith('MN'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Montenegro'); textFinder.replaceAllWith('ME'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Montserrat'); textFinder.replaceAllWith('MS'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Morocco'); textFinder.replaceAllWith('MA'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Mozambique'); textFinder.replaceAllWith('MZ'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Myanmar [Burma]'); textFinder.replaceAllWith('MM'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Namibia'); textFinder.replaceAllWith('NA'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Nauru'); textFinder.replaceAllWith('NR'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Nepal'); textFinder.replaceAllWith('NP'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Netherlands'); textFinder.replaceAllWith('NL'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Netherlands Antilles'); textFinder.replaceAllWith('AN'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('New Caledonia'); textFinder.replaceAllWith('NC'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('New Zealand'); textFinder.replaceAllWith('NZ'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Nicaragua'); textFinder.replaceAllWith('NI'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Niger'); textFinder.replaceAllWith('NE'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Nigeria'); textFinder.replaceAllWith('NG'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Niue'); textFinder.replaceAllWith('NU'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Norfolk Island'); textFinder.replaceAllWith('NF'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('North Korea'); textFinder.replaceAllWith('KP'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Northern Mariana Islands'); textFinder.replaceAllWith('MP'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Norway'); textFinder.replaceAllWith('NO'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Oman'); textFinder.replaceAllWith('OM'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Pakistan'); textFinder.replaceAllWith('PK'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Palau'); textFinder.replaceAllWith('PW'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Palestinian Territories'); textFinder.replaceAllWith('PS'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Panama'); textFinder.replaceAllWith('PA'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Papua New Guinea'); textFinder.replaceAllWith('PG'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Paraguay'); textFinder.replaceAllWith('PY'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Peru'); textFinder.replaceAllWith('PE'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Philippines'); textFinder.replaceAllWith('PH'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Pitcairn Islands'); textFinder.replaceAllWith('PN'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Poland'); textFinder.replaceAllWith('PL'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Portugal'); textFinder.replaceAllWith('PT'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Puerto Rico'); textFinder.replaceAllWith('PR'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Qatar'); textFinder.replaceAllWith('QA'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Romania'); textFinder.replaceAllWith('RO'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Russia'); textFinder.replaceAllWith('RU'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Rwanda'); textFinder.replaceAllWith('RW'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('R?ion'); textFinder.replaceAllWith('RE'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Saint Helena'); textFinder.replaceAllWith('SH'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Saint Kitts and Nevis'); textFinder.replaceAllWith('KN'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Saint Lucia'); textFinder.replaceAllWith('LC'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Saint Pierre and Miquelon'); textFinder.replaceAllWith('PM'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Saint Vincent and the Grenadines'); textFinder.replaceAllWith('VC'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Samoa'); textFinder.replaceAllWith('WS'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('San Marino'); textFinder.replaceAllWith('SM'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Saudi Arabia'); textFinder.replaceAllWith('SA'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Senegal'); textFinder.replaceAllWith('SN'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Serbia'); textFinder.replaceAllWith('RS'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Serbia and Montenegro'); textFinder.replaceAllWith('CS'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Seychelles'); textFinder.replaceAllWith('SC'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Sierra Leone'); textFinder.replaceAllWith('SL'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Singapore'); textFinder.replaceAllWith('SG'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Slovakia'); textFinder.replaceAllWith('SK'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Slovenia'); textFinder.replaceAllWith('SI'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Solomon Islands'); textFinder.replaceAllWith('SB'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Somalia'); textFinder.replaceAllWith('SO'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('South Africa'); textFinder.replaceAllWith('ZA'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('South Georgia and the South Sandwich Islands'); textFinder.replaceAllWith('GS'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('South Korea'); textFinder.replaceAllWith('KR'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Spain'); textFinder.replaceAllWith('ES'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Sri Lanka'); textFinder.replaceAllWith('LK'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Sudan'); textFinder.replaceAllWith('SD'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Suriname'); textFinder.replaceAllWith('SR'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Svalbard and Jan Mayen'); textFinder.replaceAllWith('SJ'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Swaziland'); textFinder.replaceAllWith('SZ'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Sweden'); textFinder.replaceAllWith('SE'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Switzerland'); textFinder.replaceAllWith('CH'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Syria'); textFinder.replaceAllWith('SY'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('S?Tom?nd Pr?ipe'); textFinder.replaceAllWith('ST'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Taiwan'); textFinder.replaceAllWith('TW'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Tajikistan'); textFinder.replaceAllWith('TJ'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Tanzania'); textFinder.replaceAllWith('TZ'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Thailand'); textFinder.replaceAllWith('TH'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Timor-Leste'); textFinder.replaceAllWith('TL'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Togo'); textFinder.replaceAllWith('TG'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Tokelau'); textFinder.replaceAllWith('TK'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Tonga'); textFinder.replaceAllWith('TO'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Trinidad and Tobago'); textFinder.replaceAllWith('TT'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Tunisia'); textFinder.replaceAllWith('TN'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Turkey'); textFinder.replaceAllWith('TR'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Turkmenistan'); textFinder.replaceAllWith('TM'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Turks and Caicos Islands'); textFinder.replaceAllWith('TC'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Tuvalu'); textFinder.replaceAllWith('TV'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('U.S. Minor Outlying Islands'); textFinder.replaceAllWith('UM'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('U.S. Virgin Islands'); textFinder.replaceAllWith('VI'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Uganda'); textFinder.replaceAllWith('UG'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Ukraine'); textFinder.replaceAllWith('UA'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Union of Soviet Socialist Republics'); textFinder.replaceAllWith('SU'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('United Arab Emirates'); textFinder.replaceAllWith('AE'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('United Kingdom'); textFinder.replaceAllWith('GB'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('United States'); textFinder.replaceAllWith('US'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Uruguay'); textFinder.replaceAllWith('UY'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Uzbekistan'); textFinder.replaceAllWith('UZ'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Vanuatu'); textFinder.replaceAllWith('VU'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Vatican City'); textFinder.replaceAllWith('VA'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Venezuela'); textFinder.replaceAllWith('VE'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Vietnam'); textFinder.replaceAllWith('VN'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Wallis and Futuna'); textFinder.replaceAllWith('WF'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Western Sahara'); textFinder.replaceAllWith('EH'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Yemen'); textFinder.replaceAllWith('YE'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Zambia'); textFinder.replaceAllWith('ZM'); var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getRange("K:K"); var textFinder = range.createTextFinder('Zimbabwe'); textFinder.replaceAllWith('ZW'); };>
The post Google Sheets find and replace with macro appeared first on DavebyDay.