private fun isSheetEmpty(service: Sheets, spreadsheetId: String, sheetName: String): Boolean { val result = service.spreadsheets().values().get(spreadsheetId, "'$sheetName'").execute() return result.getValues() == null || result.getValues().size == 0}
NOTE: service
is Sheets. Refer to Get Google Sheets service instance.
NOTE: Refer to Get Sheet Name.