I tried to convert PDF file that contains the data table to excel file. Here is my cord.
import tabula
# Read PDF File
df = tabula.read_pdf("files/Seniority List 2018 19.pdf", pages = 1)
# Convert into Excel File
df.to_excel('files/excel.xlsx')
but error occurred.
AttributeError Traceback (most recent call last)
Input In [5], in <cell line: 9>()
6 df = tabula.read_pdf("files/Seniority List 2018 19.pdf", pages = 1)
8 # # Convert into Excel File
----> 9 df.to_excel('files/excel.xlsx')
AttributeError: 'list' object has no attribute 'to_excel'
PDF is from here https://www.docdroid.net/jTWmB15/seniority-list-2018-19-pdf
How can I use 'to_excel'??
I just mentioned the above settings in this question but still if more code is required then tell me I'll update my question with that information. Thank you
instead of using df = tabula.read_pdf('file.pdf', pages = '1')
Use df = tabula.read_pdf('file.pdf', pages = '1')[0]