Linked Questions

Popular Questions

Error - 'charmap' codec can't decode byte 0x98

Asked by At

please help with following issue:

Code below works without any problems:

import pandas as pd
base = pd.read_excel('test.xlsx')

But when Iam trying to read the same excel file using tkinter askopenfile Ive got issue: 'charmap' codec can't decode byte 0x98 in position 668: character maps to

full code:

from tkinter import *
from tkinter import ttk
from tkinter.filedialog import askopenfile
import pandas as pd


def main_window():
    mainWindow = Tk()
    mainWindow.geometry('400x300')
    LoadFile = Button(text='Load Excel', command=lambda:upload_file())
    LoadFile.grid()
    mainWindow.mainloop()

def upload_file():
    file = askopenfile()
    pd.read_excel(file)

main_window()

I am trying to read excel file in interface library tkinter

Related Questions