How to fetch report builder's data

I have created report where report type is Report Builder and somewhere i want fetch the data i have tried with below code but query is not working

@frappe.whitelist()
def download_template_test():
	custom_report = frappe.get_doc("Report", "Payment Request Approvals")
	columns1, data = custom_report.run_query_report(user=frappe.session.user, ignore_prepared_report=True)
	frappe.msgprint(str(data))


i think, you can’t get the data from “Report Builder” report, but you can get the data from query report and server script report.

Please check it.

Demo Script (Server Script Report):

def download_template_test():
    custom_report = frappe.get_doc("Report", "Lead Details")

    filters = {
        "company": "Frappe Tech.",   # Adjust this to your company name
        "from_date": "2023-09-18",   # Adjust to your actual from_date
        "to_date": "2024-09-18"      # Adjust to your actual to_date
    }

    columns1, data = custom_report.run_query_report(filters=filters, user=frappe.session.user, ignore_prepared_report=True)

    print("Columns:", columns1)
    print("\n Data:", data)

download_template_test()

Demo Script (Query Report):

def download_template_test():
	custom_report = frappe.get_doc("Report", "Trial Balance (Simple)")
	columns, data = custom_report.run_query_report(user=frappe.session.user, ignore_prepared_report=True)
	print("Columns:", columns)
	print("\n Data:", data)

download_template_test():
1 Like

Thanks @NCP , but i want from report builder i have done with query report and script report :slightly_smiling_face: