Chart of account importer server error IndexError: list index out of range

Hi,

i have tried csv chart of account importer, but error as below when tried upload csv.

Traceback (most recent call last):
File “/opt/bench/erpnext/apps/frappe/frappe/app.py”, line 60, in application
response = frappe.api.handle()
File “/opt/bench/erpnext/apps/frappe/frappe/api.py”, line 55, in handle
return frappe.handler.handle()
File “/opt/bench/erpnext/apps/frappe/frappe/handler.py”, line 21, in handle
data = execute_cmd(cmd)
File “/opt/bench/erpnext/apps/frappe/frappe/handler.py”, line 56, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File “/opt/bench/erpnext/apps/frappe/frappe/init.py”, line 1036, in call
return fn(*args, **newargs)
File “/opt/bench/erpnext/apps/erpnext/erpnext/accounts/doctype/chart_of_accounts_importer/chart_of_accounts_importer.py”, line 63, in get_coa
forest = build_forest(generate_data_from_csv(file_name))
File “/opt/bench/erpnext/apps/erpnext/erpnext/accounts/doctype/chart_of_accounts_importer/chart_of_accounts_importer.py”, line 52, in generate_data_from_csv
if not row[2]: row[2] = row[1]
IndexError: list index out of range

Hi,
I also have the similar issue with CoA Importer.
I’m on:

erpnext 12.1.4
frappe 12.0.14

I got this error in the client browser:

request.js:352 Traceback (most recent call last):
File “/var/bench/frappe-bench/apps/frappe/frappe/app.py”, line 60, in application
response = frappe.api.handle()
File “/var/bench/frappe-bench/apps/frappe/frappe/api.py”, line 55, in handle
return frappe.handler.handle()
File “/var/bench/frappe-bench/apps/frappe/frappe/handler.py”, line 21, in handle
data = execute_cmd(cmd)
File “/var/bench/frappe-bench/apps/frappe/frappe/handler.py”, line 56, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File “/var/bench/frappe-bench/apps/frappe/frappe/init.py”, line 1036, in call
return fn(*args, **newargs)
File “/var/bench/frappe-bench/apps/erpnext/erpnext/accounts/doctype/chart_of_accounts_importer/chart_of_accounts_importer.py”, line 148, in validate_accounts
accounts = generate_data_from_csv(file_name, as_dict=True)
File “/var/bench/frappe-bench/apps/erpnext/erpnext/accounts/doctype/chart_of_accounts_importer/chart_of_accounts_importer.py”, line 50, in generate_data_from_csv
data.append({frappe.scrub(header): row[index+1] for index, header in enumerate(headers)})
File “/var/bench/frappe-bench/apps/erpnext/erpnext/accounts/doctype/chart_of_accounts_importer/chart_of_accounts_importer.py”, line 50, in
data.append({frappe.scrub(header): row[index+1] for index, header in enumerate(headers)})
IndexError: list index out of range

and also this one:

request.js:352 Traceback (most recent call last):
File “/var/bench/frappe-bench/apps/frappe/frappe/app.py”, line 60, in application
response = frappe.api.handle()
File “/var/bench/frappe-bench/apps/frappe/frappe/api.py”, line 55, in handle
return frappe.handler.handle()
File “/var/bench/frappe-bench/apps/frappe/frappe/handler.py”, line 21, in handle
data = execute_cmd(cmd)
File “/var/bench/frappe-bench/apps/frappe/frappe/handler.py”, line 56, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File “/var/bench/frappe-bench/apps/frappe/frappe/init.py”, line 1036, in call
return fn(*args, **newargs)
File “/var/bench/frappe-bench/apps/erpnext/erpnext/accounts/doctype/chart_of_accounts_importer/chart_of_accounts_importer.py”, line 63, in get_coa
forest = build_forest(generate_data_from_csv(file_name))
File “/var/bench/frappe-bench/apps/erpnext/erpnext/accounts/doctype/chart_of_accounts_importer/chart_of_accounts_importer.py”, line 107, in build_forest
account_name, _, account_number, is_group, account_type, root_type = i
ValueError: not enough values to unpack (expected 6, got 5)

And here is the csv I’m working on:

“Chart of Accounts Template”
“Column Labels : “,“1account_name”,“parent_account”,“account_number”,“is_group”,“account_type”,“root_type”
“Start entering data from here : “,“Aktiva”,””,“1000.000”,“1”,””,“Asset”
“Passiva”,“”,“2000.000”,“1”,“”,“Liability”
“Modal”,“”,“3000.000”,“1”,“”,“Equity”
“Penjualan”,“”,“4000.000”,“1”,“”,“Income”
“Beban”,“”,“5000.000”,“1”,“”,“Expense”
“Aktiva Lancar”,“Aktiva”,“1100.000”,“1”,“”,“Asset”
“Kas”,“Aktiva Lancar”,“1110.000”,“1”,“Cash”,“Asset”
“Kas Rupiah”,“Kas”,“1111.000”,“1”,“Cash”,“Asset”
“Kas di kasir”,“Kas Rupiah”,“1111.002”,“0”,“Cash”,“Asset”
“Kas di tangan”,“Kas Rupiah”,“1111.001”,“0”,“Cash”,“Asset”
“Kas Mata Uang Lain”,“Kas”,“1112.000”,“1”,“”,“Asset”
“Kas USD”,“Kas Mata Uang Lain”,“1112.001”,“0”,“Cash”,“Asset”
“Bank”,“Aktiva Lancar”,“1120.000”,“1”,“”,“Asset”
“Bank Mandiri Giro”,“Bank”,“1120.001”,“0”,“Bank”,“Asset”
“Bank II”,“Bank “,“1120.002”,“0”,“Bank”,“Asset”
“Aktiva Tetap”,“Aktiva”,“1200.000”,“1”,””,“Asset”
“Aktiva Tetap Berwujud”,“Aktiva Tetap”,“1201.000”,“1”,“”,“Asset”
“Rumah Produksi”,“Aktiva Tetap Berwujud”,“1201.001”,“0”,“Fixed Asset”,“Asset”
“Pasiva Lancar”,“Passiva”,“2100.000”,“1”,“”,“Liability”
“Pendapatan di Terima di Muka”,“Pasiva Lancar”,“2120.000”,“1”,“”,“Liability”
“DP Penjualan”,“Pendapatan di Terima di Muka”,“2120.001”,“0”,“Bank”,“Liability”
“Modal A”,“Modal”,“3100.000”,“1”,“”,“Equity”
“Saldo pembukaan Equity”,“Modal A”,“3130.000”,“0”,“”,“Equity”
“Modal Soedibyo”,“Modal A”,“3100.001”,“0”,“”,“Equity”
“Penjualan Barang Dagangan”,“Penjualan”,“4100.000”,“1”,“”,“Income”
“Penjualan”,“Penjualan Barang Dagangan”,“4110.000”,“0”,“”,“Income”
“Beban Langsung”,“Beban”,“5100.000”,“1”,“”,“Expense”
“Biaya Gaji & Kesejahteraan Pegawai”,“Beban Langsung”,“5120.000”,“1”,“”,“Expense”
“Biaya Gaji Staff & Karyawan Tetap”,“Biaya Gaji & Kesejahteraan Pegawai”,“5120.001”,“0”,“”,“Expense”

I have not see any single sample of csv for this purpose yet. Even in the documentation doesn’t show the csv format sample (only in spreadsheet format) here:
https://erpnext.com/docs/user/manual/en/setting-up/chart-of-accounts-importer
and also the video tutorial doesn’t show the format in csv:
ERPNext - Chart of Accounts Importer in Version 12

So, I made this csv only based on the header format, the exported existing CoA which are every single data surrounded by double quotes. And according to the documentation, I need to add the data starting from the same line with this line from the given template:

"Start entering data from here : "

And should I add comma as separator after that as separator before I put the first account data?
So, here is my first CoA line:

“Start entering data from here : “,“Aktiva”,””,“1000.000”,“1”,“”,“Asset”

Is there anything wrong with my csv?

TIA,
Roy

Hi Roylrwan,

This is a snapshot of my file that worked without errors…let me know if you need more assistance.
--------------------------------------------------csv file -----------------------------------------
Chart of Accounts Template,
Column Labels : ,Account Name,Parent Account,Account Number,Is Group,Account Type,Root Type
Start entering data from here : ,Revenue,1,Income Account,Income
,Product Sales,Revenue,1,Income Account,Income
,Hardware Sales,Product Sales,0,Income Account,Income
,Software Sales,Product Sales,0,Income Account,Income
,Product Services Sales,Product Sales,0,Income Account,Income
,Services,Revenue,1,Income Account,Income
,Manage services Sales,Services,0,Income Account,Income
,Consulting services Sales,Services,0,Income Account,Income
,Implementation services Sales,Services,0,Income Account,Income
,Support services Sales,Services,0,Income Account,Income
,Other Revenue,Revenue,1,Income Account,Income
,Sub Contractors Sales,Other Revenue,0,Income Account,Income
,Sundries Revenue,Other Revenue,0,Income Account,Income
,Travel & Subsistence,Other Revenue,0,Income Account,Income

1 Like

Thanks @hpema108,

Based on your csv snapshot format, I have successfully import my CoA! :wink::+1:

Roy