Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

194
Views
Google sheets API fetch the value of Merged cells

I am using Google Sheets API to display the data from my Google Spreadsheet in my javascript application. Have developed by refering this documentation. I could able to read the values from my spreadsheet but for some of the columns the cells are merged as below.

enter image description here

I am getting the Json response as

[
[
  "Name",
  "Age"
 ],
[
  "John",
  "25"
 ],
[
  "Doe"
 
 ],
]

My expected output should be

   [
[
  "Name",
  "Age"
 ],
[
  "John",
  "25"
 ],
[
  "Doe",
   "25"
 
 ],
]

Any help ?

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

To retrieve the value, you have to test if the cell is part of a merged area.

var value = (cell.isPartOfMerge() ? cell.getMergedRanges()[0].getCell(1,1) : cell).getValue();
about 4 years ago · Juan Pablo Isaza Report

0

Modify the script as following

    appendPre('Name, Major:');
    var lastData=''
    for (i = 0; i < range.values.length; i++) {
      var row = range.values[i];
      if (row[4]!=''){lastData=row[4]}
      // Print columns A and lastData, which correspond to indices 0 and the last known value in column E that contains merged cells.
      appendPre(row[0] + ', ' + lastData);
    }

so that you will recall the last value if the cell is empty

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!