I have an IF ELSE statement in my GAS code that takes the string value of a cell in the sheet and assigns an integer to a variable based on that string.
var sheetStatus = sheet.getSheetByName('Supply Projections').getRange('J4').getValue()
var sheetConnection = sheet.getSheetByName('Supply Projections').getRange('K6').getValue()
var sheetFuelTech = sheet.getSheetByName('Supply Projections').getRange('J6').getValue()
var sheetFuelTechCol
if (sheetFuelTech = "Fuel") {
sheetFuelTechCol = 7
} else {
sheetFuelTechCol = 6
}
'sheetFuelTech' refers to the string value of the cell in the sheet. If the string is "Fuel", I want the number 7 to be assigned to the variable 'sheetFuelTechCol'. If the string is anything else, assign the number 6 to 'sheetFuelTechCol'.
However, the statement doesn't seem to work. It always resolves to 7, no matter what the string in the cell is. Is anyone able to tell me why this isn't working? Thanks.
Aucun commentaire:
Enregistrer un commentaire