I have a method export a doctype to csv file.
import csv
def export_csv_file():
tests = frappe.db.sql(“”“SELECT ID, Name From tabAccount”“”)
with open(‘/home/utf.csv’,‘w’) as fout:
writer=csv.writer(fout)
writer.writerows([tests.keys()])
for row in zip(*tests.values()):
row=[s.encode(‘utf-8’) for s in row]
writer.writerows([row])
I want to customize frappe.core.page.data_import_tool.exporter.get_template()
I have a SQL query .
Ex: "Select ID, Name from tabAccount "
then, I use frappe.db.sql("Select ID, Name from tabAccount ")
then, Write to file csv .
1213131, jacson
1312133, lead
1213133, jame
can you help me ?