Open a Datafile(csv,xls,xlsx,ods, etc) using "FILEPICKER" python?
<p>I got to know how to open a data file when we know the name and type of the file but how do we code to pick a file with file picker?</p>

<pre><code>import pyexcel as pe  
records = pe.get_records(file_name="your_file.xls")  
for record in records:  
     print("%s is aged at %d" % (record['Name'], record['Age']))
</code></pre>

<p>You can def a function to return the name of the function which you can use as input for pe.get_records().
    <code>
from  tkinter import *
    root = Tk()
    def get_file_name():
        global root
        root.filename =  filedialog.askopenfilename(initialdir = "D:/",title = "choose your excel file",filetypes = (("excel files","*.xls"),("all files","*.*")))
        print (root.filename)
        root.withdraw()
        return root.filename</code></p>

python excel csv xls filepicker