I need to restrict the ImportRange function below to show only visible rows as some of the rows are filtered and some of the rows are grouped.
At this time IMPORTRANGE can't import only visible rows. Currently there isn't any built-in function that does that and this can't be done by using a custom function as accesing an external range require authorization and custom functions can't use methods that require it.
The alternative is to use another kind of script, and add-on or a third party application.
Follow this answer.
A1cell to be
=filter(Sheet1!A:X, Sheet1!A:A>1)). (See docs on the filter function.)