diff --git a/visidata/basesheet.py b/visidata/basesheet.py index e10268978..9eb35ccab 100644 --- a/visidata/basesheet.py +++ b/visidata/basesheet.py @@ -333,7 +333,7 @@ def getSheet(vd, sheetname): try: sheetidx = int(sheetname) return vd.sheets[sheetidx] - except ValueError: + except (ValueError, IndexError): pass if sheetname == 'options': diff --git a/visidata/main.py b/visidata/main.py index 28286dc8f..5b00afbe5 100755 --- a/visidata/main.py +++ b/visidata/main.py @@ -155,9 +155,11 @@ def moveToPos(vd, sources, startsheets, startcol, startrow): rowidx = vs.getRowIndexFromStr(vd.options.rowkey_prefix + subsheet) if rowidx is None: vd.warning(f'{vs.name} has no subsheet "{subsheet}"') - vs = None - break + return vs = vs.rows[rowidx] + if not isinstance(vs, BaseSheet): + vd.warning(f'row {subsheet} for subsheet is not a sheet') + return vd.options.set('load_lazy', True, obj=vs) vd.sync(vs.ensureLoaded()) vd.clearCaches()