HikaruHara for pointing this out. · 2. Tabular also will not work when the file is larger than 5000 lines. · Thank you very kindly for clarifying this. · 3. Here is my code in case you find Tabular a bit overkill: import son, PDF import tabular import OS file = open('filename.excel'','w') file_tables = [] for line in son.headlines(file): line_names = [] for f in line.split(':')[0:]: line_names.append(f) with open('filename.pdf', 'WB') as f: f.write(line_names) f.flush() file = open('filename.excel'','r') for line in tabular.tabular_table([file['n'] for line in line_names])[0:]: file_tables.append(line) for line in file['n']: file.write(line) file.close() 2. Please also try: import tabular and tab = tabular.read_data() file = open('filename.pdf', 'r') for line in tabular.tabular_table([file['n'] for line in line_names]): file_tables.append(line) for line in file['n']: file.write(line) file.close() 3. Please also try: import PDF. Tabular tables = PDF.