'Returns file in for the report in given format'

def get_report_content(self):

    report = frappe.get_doc(u'Report', self.report)
    if ((self.report_type == u'Report    Builder') and self.data_modified_till):
        self.filters = (json.loads(self.filters) if self.filters else {})
        self.filters[u'modified'] = (u'>', (frappe.utils.now_datetime() - timedelta(hours=self.data_modified_till)))
    (columns, data) = report.get_data(limit=(self.no_of_rows or 100), user=self.user, filters=self.filters, as_dict=True)
    columns.insert(0, frappe._dict(fieldname=u'idx', label=u'', width=u'30px'))
    for i in range(len(data)):
        data[i][u'idx'] = (i + 1)
    if ((len(data) == 0) and self.send_if_data):
        return None
    if (self.format == u'HTML'):
        return self.get_html_table(columns, data)
    elif (self.format == u'XLSX'):
        spreadsheet_data = self.get_spreadsheet_data(columns, data)
        xlsx_file = make_xlsx(spreadsheet_data, u'Auto    Email    Report')
        return xlsx_file.getvalue()
    elif (self.format == u'CSV'):
        spreadsheet_data = self.get_spreadsheet_data(columns, data)
        return to_csv(spreadsheet_data)
    else:
        frappe.throw(_(u'Invalid    Output    Format'))
