title: How do I know if spreadsheet cells are merged using google apps script
body: <p>In a Google docs spreadsheet.
  If cells A1 &amp; A2 are merged, is there a way
  to confirm they are merged, using google apps script?</p>
  
  <p>There is a merge function in GAS <a href="https://developers.google.com/apps-script/class_range#merge" rel="noreferrer">https://developers.google.com/apps-script/class_range#merge</a></p>
  
  <p>But there is no function or example that shows how to check if cells are merged.</p>
  
  <p>getValues etc just returns an empty string for the cell. e.g. this
   does not work.</p>
  
  <pre><code>function testMerge() {
  
    var spreadsheet = SpreadsheetApp.openById('Z3ppTjxNUE........'); 
    var sheet = spreadsheet.getSheets()[0];
    var range = sheet.getRange("A3:A4");
    var values = range.getValues();
    var formulas = range.getFormulasR1C1();
    var formulasA1 = range.getFormulas();
  
    range = sheet.getRange("A4");
    range.setValue("a");
  
    range = sheet.getRange("A3:A4");
    var values2 = range.getValues();
    var formulas2 = range.getFormulasR1C1();
    var formulasA12 = range.getFormulas();
  
  
    var count = range.getHeight();
  
  
  }
  </code></pre>