I'm trying to figure out what logic to use to be able to read this PDF questionnaire. (insert) The idea is that the answers to this questionnaire are saved in an excel. Following this style. (insert excel) I'm trying to first read the PDF in a txt to get an idea of how to do the logic but I don't know how I can implement it since it is very confusing to do it in excel format. PDF file github: https://github.com/Gianlo478/PDF.git This is my code that I'm using to read it in txt, but I don't know exactly how to use the logic so that it works correctly in several pdfs of this same style. import pdfplumber pdf_path = r"C:\\Users\\User\\Desktop\\Input\\Preguntas_respuestas.pdf" output_txt = r"C:\\Users\\User\\Desktop\\Output\\respuesta.txt" def format_table(rows): formatted = [] for row in rows: if any(row): formatted.append("//".join(cell.strip() if cell else "" for cell in row)) return "\n".join(formatted) with pdfplumber.open(pdf_path) as pdf, open(output_txt, "w", encoding="utf-8") as output_file: for page_number, page in enumerate(pdf.pages, start=1): tables = page.extract_tables() if tables: for table_index, table in enumerate(tables, start=1): output_file.write(f"Página {page_number}, Tabla {table_index}:\n") output_file.write(format_table(table)) output_file.write("\n\n") print(f"Tablas extraídas y guardadas en '{output_txt}'") The objective is that the PDF records the data marked by an "X" being 1 if the box on the left is checked (YES) and 0 for the box on the right (NO), in the case of the third question, it is 2 if the third box is checked. If it only has 1 answer box like the questions below, it is 1 if you check X and 0 if you don't check anything. How exactly would the logic of this type of script work or how possible is it to do so? Continue reading...