Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Digitize tables in PDF to CSV
require 'tabula'
pdf_file_path = "Abschiebungen.pdf"
outfilename = "Abschiebungen.csv"
out = open(outfilename, 'w')
extractor = Tabula::Extraction::ObjectExtractor.new(pdf_file_path, :all )
extractor.extract.each do |pdf_page|
pdf_page.spreadsheets.each do |spreadsheet|
out << spreadsheet.to_csv
out << "\n\n"
end
end
out.close
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment