I'm not sure if it's a fault of my installation, the version I'm using or just newbie fails but all the examples of using the pdf modules to open a table and export to Excel aren't working and give errors
for example:
[code]
import openpyxl
import tabula
# Read in the PDF file
df = tabula.read_pdf("table.pdf", pages="all")
# Create a new Excel file
wb = openpyxl.Workbook()
ws = wb.active
# Iterate through the rows and columns of the dataframe and write the values to the Excel worksheet
for r in df.index.tolist():
for c in df.columns:
ws.cell(row=r+1, column=c+1).value = df.iloc[r, c]
# Save the Excel file
wb.save("table.xlsx")
[/code]
Gives the error on the first for line
AttributeError: 'builtin_function_or_method' object has no attribute 'tolist'
Examples from this page seem to be OK
Scraping Tables from PDF Files Using Python | Towards Data Science
... however only after I removed the all=true option
What's at fault here?