How to deal with merged cells in a table

Hi all,

I'm trying to scrape a table (see attachment) and am having trouble specifying the correct headers for each column since the cells are merged. After scraping, all the data in the data rows ends up being pushed to the left since there are more columns than there than there are headers.

I've tried editing the selected element for the header rows and data rows and using different selectors but nothing really seems to work. I'm convinced, though, that there is a very easy solution that I'm just not aware of yet. If anyone has experience or knows how to get around table formats, I would greatly appreciate any help.

Url: https://datawarehouse.dbd.go.th/fin/profitloss/5/0105518011759
// The URL requires captcha authentication, but the sitemap will run if it's completed
// The website will be in Thai initially, there is a button on the top right-hand corner that will switch the site language to English

The table:

Sitemap:
{"_id":"table-support","startUrl":["c"],"selectors":[{"id":"table","type":"SelectorTable","parentSelectors":["_root"],"selector":"table.table","multiple":true,"columns":[{"header":"Unit : Baht","name":"Unit : Baht","extract":true},{"header":"2017","name":"2017","extract":true},{"header":"2018","name":"2018","extract":true},{"header":"2019","name":"2019","extract":true}],"delay":0,"tableDataRowSelector":"tbody tr","tableHeaderRowSelector":"tr.th-light"}]}

The csv with this sitemap:


// Note that the data is confined to only 3 headers.

Once again, thank you and I appreciate all the help!

Type: Table would not work here, cos WS will auto-detect the top row as the headers and only create 4 columns based on Unit, 2017, 2018, 2019. So you would need to manually create row scrapers to get all 7 columns.

Hey, sorry for the slow reply. Would I have to just create a table selector and select different rows each time?