I've never used exceljs. Like you, reading the docs on GitHub, I don't see anything that provides a validity test of a cell address.
Rolling your own parser might be an okay idea. I think you've probably enumerated the major cases in the OP, the (probably) complete grammar would be:
// where [] means optional
cell_address = [sheet_name!][$]col_name[$]row_number
range = cell_address:cell_address
A quicker-to-try-out idea is to use try / catch
with getCell
or one of its ilk. Something like...
function isValidAddress(worksheet, string) {
try {
worksheet.getCell(string);
return true;
} catch (error) {
return false;
}
}
If the library has its own unexposed parser (you can leaf thru source and maybe get the best answer that way, via copy paste), it will probably throw on a bad address, and this will work. This will be a little more execution than required, but if you're not doing zillions of these in a tight loop, it might be good enough to use.