I have hit a dead end - need some help! code is below. Should be very simple.... I have an array that is many rows long and 33 columns wide..... I just need to get all the commas out of the array values. The array is composed of some string fields and also some number fields..... Any help is appreciated!
So far I can't get any luck with the .replace function.... thanks
function Pipeline() {
var writelocation = SpreadsheetApp.openById(globalvariables().importerid);
var writesheet = writelocation.getSheetByName("Pipeline");
var linkssheet = writelocation.getSheetByName(globalvariables().linkstab);
writesheet.getRange("A:AG").clear();
//var length = 1 + getLastRowSpecial(linkssheet.getRange("C:C").getValues());
var length = 5;
var array = [];
var array = [
["Highlight", "Customer", "Prospect", "Type", "Status", "Product Detail & Comments", "Start Date", "End Date", "Bulk Sales", "Bulk GM%", "Non-Bulk Sales", "Non-Bulk GM%", "Safety Sales", "Safety GM%", "Welding Sales", "Welding GM%", "Rent / Other Sales", "Rent / Other GM%", "Source", "Segment", "Competitor", "Contract Expiration", "Win Reason", "Loss Reason", "PSA Won", "Contacts", "Probability", "Monthly Sales", "Monthly GM", "12M Sales", "District", "Area", "Salesperson"]
];
for (i=2; i<length; i++) {
var source = SpreadsheetApp.openByUrl(linkssheet.getRange(i,3).getValue()).getSheetByName("Pipeline").getRange("A4:AG").getValues().filter(function(item){ return item[4] != ""; });
for (k=0; k<source.length; k++) {
for (j=0; j<source[k].length; j++) {
source[k][j].toString().replace(/[,]/g,'-');
}
array.push(source[k]);
}
}
writesheet.getRange(1,1,array.length,array[0].length).setValues(array);
linkssheet.getRange("E3").setValue(new Date()).setNumberFormat("yyyy-MM-dd HH:mm:ss");
}