I want to create an Import button new

I want to create an Import button like image in the view menu of my Staff doctype. I want when I click on it, it will allow me to import the excel file. That file will be saved into frappe’s core File doctype and then update the data into my Staff doctype. Please help me.

Code to add custom button in list view

frappe.listview_settings['Staff'] = {
    refresh: function(listview) {
        listview.page.add_inner_button("Import", function() {
            // your logic here
        });;
    },
};

Data import logic, you can get from this file.

2 Likes

I use vuejs to create that button, can I use it?

The list view you are seeing was created by me using frappe-ui, not the list view in core frappe.

I don’t have any idea about frappe-ui, sorry about that.

In this case, I can only help you with the logic to import data. The code below imports data from a CSV, so this script may help you import data.

Can you summarize for me an import flow in frappe core? Thank you very much.

Can you take a picture to show me where the button is?

It is hard to explain whole process I will share some frappe core data import code links.

This button is inside Chart of Accounts Importer

Thank you, I have found its location. But this is not about creating a field in the doctype file for import. I want to create a new FileUploader in frapper-ui (link: Frappe UI) to import data.