Linked Questions

Popular Questions

I am trying to create a custom template for writing a condensed description in google sheets. First, I want the information from both the "title" and "notes" column under "input" sheet to be denoted as the first and second statement respectively.

Then, given the material and condition information, I want to extract and add the information from the cross-reference table under "condition*_chart"


INPUT SHEET

input sheet


CONDITION CHART

condition chart


This is what I have so far.

function getDescription(title, notes, material, condition) {
  let description = """";
  if (title) {
    description += title + "". "";
  }
  if (notes) {
    description += notes + "". "";
  }
  if (material && condition) {
    if (material === ""CD"" && condition === ""M"") {
      description += var condition_chartSheet.getRange(2, 2).getValue();
    } else if (material === ""CD"" && condition === ""NM or M-"") {
      description += var condition_chartSheet.getRange(2, 3).getValue();
    } else if (material === ""CD"" && condition === ""VG+/EX"") {
      description += var condition_chartSheet.getRange(2, 4).getValue();
    } else if (material === ""CD"" && condition === ""VG"") {
      description += var condition_chartSheet.getRange(2, 5).getValue();
    } else if (material === ""CD"" && condition === ""G/G+"" || ""G+"" || ""G"") {
      description += var condition_chartSheet.getRange(2, 6).getValue(); 
    } else if (material === ""CD"" && condition === ""P"" || ""F"" || ""F/P"") {
      description += var condition_chartSheet.getRange(2, 7).getValue(); 
    } else if (material === ""Cassette"" && condition === ""M"") {
      description += var condition_chartSheet.getRange(3, 2).getValue();
    } else if (material === ""Cassette"" && condition === ""NM or M-"") {
      description += var condition_chartSheet.getRange(3, 3).getValue();
    } else if (material === ""Cassette"" && condition === ""VG+/EX"") {
      description += var condition_chartSheet.getRange(3, 4).getValue();
    } else if (material === ""Cassette"" && condition === ""VG"") {
      description += var condition_chartSheet.getRange(3, 5).getValue();
    } else if (material === ""Cassette"" && condition === ""G/G+"" || ""G+"" || ""G"") {
      description += var condition_chartSheet.getRange(3, 6).getValue(); 
    } else if (material === ""Cassette"" && condition === ""P"" || ""F"" || ""F/P"") {
      description += var condition_chartSheet.getRange(3, 7).getValue(); 
    } else if (material === ""Vinyl"" && condition === ""M"") {
      description += var condition_chartSheet.getRange(4, 2).getValue();
    } else if (material === ""Vinyl"" && condition === ""NM or M-"") {
      description += var condition_chartSheet.getRange(4, 3).getValue();
    } else if (material === ""Vinyl"" && condition === ""VG+/EX"") {
      description += var condition_chartSheet.getRange(4, 4).getValue();
    } else if (material === ""Vinyl"" && condition === ""VG"") {
      description += var condition_chartSheet.getRange(4, 5).getValue();
    } else if (material === ""Vinyl"" && condition === ""G/G+"" || ""G+"" || ""G"") {
      description += var condition_chartSheet.getRange(4, 6).getValue(); 
    } else if (material === ""Vinyl"" && condition === ""P"" || ""F"" || ""F/P"") {
      description += var condition_chartSheet.getRange(4, 7).getValue(); 
    } else {
      description += ""No description available."";
    }
  } else {
    description += ""No description available."";
  }
  return description;
}"

Please forgive for which I am fairly new to programming. Any help would be appreciated.

Related Questions