Read xlsx file as dataframe inside .rar pack in python directly

150 views Asked by At

I need help to read xlsx file present inside rar pack. I am using below code, however get an error. Is there any better way to read/extract file?

rar = glob.glob(INPATH + "*xyz*.rar*")
rf = rarfile.RarFile(rar[0])
for f in rf.infolist():
    print(f.filename, f.file_size)
    df = pd.read_excel(rf.read(f))

rarfile.RarCannotExec: Cannot find working tool

1

There are 1 answers

0
MattDMo On

According to the brief PyPI docs, you need unrar installed and on your PATH in order for the module to work. It does not implement the RAR unpacking algorithm itself.

(Presumably you need rar as well, for creating archives.)