How can we use widgets in console application? Thanks

Widgets belong to a web application, not a console application

however, have a look at CWidgetFactory::createWidget()


I am sending emails using a cron job and I need a table inside the email body like I would have on web application using widget with CGridView and dataprovider. Is there any other way to implement this?(other function beside widget, which takes as parameters CGridView and dataprovider and returns a table)

CConsoleCommand has a method renderFile() you can use to load your email-template

where could i import widget?