Last active
January 11, 2020 09:51
-
-
Save PolarBearGG/d44116436d92e5d7ea8163f2a7d1b63e to your computer and use it in GitHub Desktop.
Purify text and display it as a number
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function parseFloat1(a) { | |
var ss = SpreadsheetApp.getActiveSpreadsheet(); | |
var sheet = ss.getActiveSheet(); | |
var range = sheet.getRange(a).getValues(); | |
var new_arr = []; | |
for (var i = 0; i < range.length; i++) { | |
var item = range[i] | |
var converted = parseFloat(item.toString().replace(/[^-?0-9.]/g, "")); | |
if (isNaN(converted)) | |
new_arr.push(['']); | |
else | |
new_arr.push([parseFloat(item.toString().replace(/[^-?0-9.]/g, ""))]); | |
} | |
//var rangeTO = sheet.getRange(b).setValues(new_arr); | |
return new_arr | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment