If SQLite is compiled with SQLITE_ENABLE_DBSTAT_VTAB, you can query the dbstat table. This should return the table size (in bytes) of table TABLENAME:
SELECT SUM("pgsize") FROM "dbstat" WHERE name="TABLENAME";
https://www.sqlite.org/dbstat.html
This is what is used by the sqlite3_anazlyer CLI tool, which can also be used for this purpose.