node-google-spreadsheet icon indicating copy to clipboard operation
node-google-spreadsheet copied to clipboard

Getting value of merged cells having one of the cells

Open LeoDoldan7 opened this issue 3 years ago • 3 comments

Hey guys!

I have some cells merged in the range B2:B6. I got one of the cells using getCellByA1:

const cell = sheet.getCellByA1('B3')

Is there any way I can get the value of the merged cell?

cell.value returns null. Same happens with all the methods mentioned here.

Thanks! Awesome package.

LeoDoldan7 avatar Oct 05 '20 12:10 LeoDoldan7

So this is how the google api works - reading from a merged cell, other than the top-left one - will return empty.

The way to deal with this is to read from the sheet's "merges" info - see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/sheets

This is not something I've dealt with yet. Would be open to PRs though!

theoephraim avatar Nov 30 '20 18:11 theoephraim

Hi, is there a method to get "merges" with this wrapper ?

Cerix avatar Jan 07 '21 15:01 Cerix

Haven't implemented it yet, but it should be pretty straightforward. Feel free to open a PR!

theoephraim avatar Jan 08 '21 00:01 theoephraim