ValidationError: Invalid template file for import

I have upgraded to erpnext version 12. I notice there is a new import file with a more friendly csv/xlsx template.

I tried this from the web interface and it worked great.
However, I tried this from the console but I keep getting the ValidationError: Invalid template file for import. I believe I got the file location right and the file exists. I need to import 100,000 records.

I even setup a new installation on a new server to be sure but it’s the same thing.

See the command I ran below.
bench --site data-import --doctype Customer --file ~/part_farmers.csv

See the error message below.

Traceback (most recent call last):
File “/usr/lib/python3.6/”, line 193, in _run_module_as_main
main”, mod_spec)
File “/usr/lib/python3.6/”, line 85, in _run_code
exec(code, run_globals)
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/”, line 99, in
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/”, line 18, in main
File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/”, line 764, in call
return self.main(*args, **kwargs)
File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/”, line 717, in main
rv = self.invoke(ctx)
File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/”, line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/”, line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/”, line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/”, line 555, in invoke
return callback(*args, **kwargs)
File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/”, line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/”, line 26, in _func
ret = f(frappe.dict(ctx.obj), *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/”, line 333, in data_import
import_file(doctype, file_path, import_type, submit_after_import, console=True)
File “/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/data_import/”, line 168, in import_file
doctype=doctype, file_path=file_path, data_import=data_import, console=console
File “/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/data_import/”, line 47, in init
File “/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/data_import/”, line 331, in init
(“Invalid template file for import”))
File “/home/frappe/frappe-bench/apps/frappe/frappe/”, line 377, in throw
msgprint(msg, raise_exception=exc, title=title, indicator=‘red’, is_minimizable=is_minimizable)
File “/home/frappe/frappe-bench/apps/frappe/frappe/”, line 356, in msgprint
File “/home/frappe/frappe-bench/apps/frappe/frappe/”, line 316, in _raise_exception
raise raise_exception(msg)
frappe.exceptions.ValidationError: Invalid template file for import

is there an extra option in version 12 that i am missing? i have looked in the forum and no one seems to have posted anything on this ValidationError. I suspect it is not seeing the file path or I got it wrong somewhere.

I would appreciate any assistance.
Thank you.

Which option did you use for import? Data Import or Data Import Legacy?

Hello Kenneth,
Thanks for your response. See command below.

bench --site data-import --doctype Customer --file ~/part_farmers.csv
Note that I used the file for a.successful import through the web interface.

I am using version 12 which I assume uses the new data import with the friendly template.
erpnext 12.13.0
frappe 12.11.0

Thanks and regards.


I figured it out. The file path has to be entered in full. No assumptions. file was in the frappe folder. Had to do /home/frappe/frappe-bench even though I was in the folder.

I still have errors but I think those are issues with the data. Need to create some link references.


1 Like