title: Tika- Pandas bridge to export PDF content to Excel?
body: <p>I would like Python to read a PDF file ("Spain.pdf" containing 11 columns and 59 rows, one of which is a header) and export its contents to Excel.</p>
  
  <p>There are <strong>many</strong> PDF-Excel threads on here, but none that I consulted address the concept of a bridge from parsed Tika content to Pandas data frames that write to Excel.</p>
  
  <p>I've searched this site (and elsewhere), talked to a couple of programmers, and consulted some manuals and books. I can't R_every_FM because, as a novice, I don't know where to focus: i.e., do I want to flush content into a Pandas data frame?</p>
  
  <p>From SO and Sweigart (2015) I found Tika, Tabula, and PyPDF2 to parse PDF content. Tika worked best for me. (The Tabula app is great for manual dumps, but the Python module doesn't run for me.) I used the following code:</p>
  
  <pre><code>from tika import parser
  raw = parser.from_file('spain.pdf')
  print(raw['content'])
  </code></pre>
  
  <p>which prints clean content to my console.</p>
  
  <p>I'm trying to transfer this content into a data frame, which I could then export to Excel via XlsxWriter (or a similar module):</p>
  
  <pre><code>import pandas as pd
  dataSpain = pd.DataFrame({'Survey': ["Key","ISO","Country","Region","Province","Comarca","City","Name","Age","Gender","Hospital"]})
  datatoexcel = pd.ExcelWriter("FromPython.xlsx",engine='xlsxwriter')
  dataSpain.to_excel(datatoexcel, sheet_name='Sheet1')
  datatoexcel.save()
  </code></pre>
  
  <p>Could someone please point me in the right direction? Any thoughts would be appreciated. Many thanks for your attention.</p>
  
  <p>Code is written in Atom 1.45 and run via Windows PowerShell 5.1. Environment is Python v3.8.0 on a Microsoft Surface 2 laptop running Windows 10 Home v1903.</p>