image120
051 Learning how to turn documents, PDF, pictures and texts into structured formats
25 January 2025
image67
054 Converting text data into a structured form
28 January 2025

052 Example of converting a PDF -document into a table

One of the most common tasks in construction projects is to process specifications in PDF format. To demonstrate the transition from unstructured data to a structured format, let’s consider a practical example: extracting a table from a PDF document and converting it to CSV or Excel format (Fig.‎ 4.1-2).

image80
Fig.‎ 4.1-2 Unlike PDF, the CSV and XLSX formats are widely available and easily integrated into various data management systems.

LLM language models, such as ChatGPT, LlaMa, Mistral DeepSeek, Grok, Claude, QWEN greatly simplify the way data scientists work with data, reducing the need for deep learning of programming languages and allowing many tasks to be solved with text queries.

Therefore, instead of spending time searching for solutions on the Internet (usually the StackOverFlow website or thematic forums and chats) or contacting data processing specialists, we can use the capabilities of modern online or local LLMs. It is enough to ask a query and the model will provide ready code for converting a PDF -document into a tabular format.

  • Send the following text request to any LLM -model (CHATGRT, LlaMa, Mistral DeepSeek, Grok, Claude, QWEN or any other):

    Please write a code to extract text from a PDF -file that contains a table. The code should take the file path as an argument and return the extracted table as a DataFrame⏎

  • The LLM -model response will in most cases be in the form of code in Python, as this language is widely used for data processing, automation and working with various file formats:
Рисунок 1
Fig.‎ 4.1-3 The LLM response in the form of Python code and its libraries and packages (Pandas, Fitz) extracts text from a PDF -file.

This code (Fig. 4.1-3) can be run offline in one of the popular IDEs we mentioned above: PyCharm, Visual Studio Code (VS Code), Jupyter Notebook, Spyder, Atom, Sublime Text, Eclipse with PyDev plugin, Thonny, Wing IDE, IntelliJ IDEA with Python plugin, JupyterLab or popular online tools: Kaggle.com, Google Collab, Microsoft Azure Notebooks, Amazon SageMaker.

  • In the “Convert” step, we use the popular Pandas library (which we discussed in detail in the chapter “Python Pandas: an indispensable tool for working with data”) to read the extracted text into the DataFrame and save the DataFrame to a CSV table file or XLXS:

    I need code that will convert the resulting table from a PDF -file to a DataFrame. Also add code to save the DataFrame to a CSV file ⏎

  • LLM’s response:
image168
Fig.‎ 4.1-4 Converting the extracted table from PDF to DataFrame and saving the table to a CSV-file.

If an error occurs when executing the code (Fig.‎ 4.1-3, Fig.‎ 4.1-4) – for example, due to missing libraries or wrong file path – the error text can simply be copied together with the source code and resubmitted to the LLM -model. The model will analyze the error message, explain what the problem is and suggest fixes or additional steps.

Thus, interaction with the AI LLM becomes a complete cycle: request → response → test → feedback → correction – without the need for deep technical knowledge.

Using a plain text query in LLM chat and a dozen lines of Python that we can run locally in any IDE, we converted a PDF -document into a tabular CSV format, which, unlike a PDF document, is easily machine readable and quickly integrated into any data management system.

We can apply this code (Fig.‎ 4.1-3, Fig.‎ 4.1-4), by copying it from any LLM chat room, to tens or thousands of new PDF documents on the server, thereby automating the process of converting a stream of unstructured documents into a structured CSV table format.

But PDF documents do not always contain text, more often than not they are scanned documents that need to be processed as images. Although images are inherently unstructured, the development and application of recognition libraries allow us to extract, process and analyze their content, enabling us to make full use of this data in business processes.

.

Leave a Reply

Change language

Post's Highlights

Stay updated: news and insights



We’re Here to Help

Fresh solutions are released through our social channels

UNLOCK THE POWER OF DATA
 IN CONSTRUCTION

Dive into the world of data-driven construction with this accessible guide, perfect for professionals and novices alike.
From the basics of data management to cutting-edge trends in digital transformation, this book
will be your comprehensive guide to using data in the construction industry.

Related posts 

Focus Areas

Search

Search
Sorry, no articles found.

✕

Don't miss the new solutions

 

 

✕
✕

Linux

macOS

Looking for the Linux or MAC version? Send us a quick message using the button below, and we’ll guide you through the process!

✕

📥 Download OnePager

Welcome to DataDrivenConstruction—where data meets innovation in the construction industry. Our One-Pager offers a concise overview of how our data-driven solutions can transform your projects, enhance efficiency, and drive sustainable growth. 

✕

🚀 Welcome to the future of data in construction!

You're taking your first step into the world of open data, working with normalized, structured data—the foundation of data analytics and modern automation tools.

By downloading, you agree to the DataDrivenConstruction terms of use 

Stay ahead with the latest updates on converters, tools, AI, LLM
and data analytics in construction — Subscribe now!

✕

🚀 Welcome to the future of data in construction!

You're taking your first step into the world of open data, working with normalized, structured data—the foundation of data analytics and modern automation tools.

By downloading, you agree to the DataDrivenConstruction terms of use 

Stay ahead with the latest updates on converters, tools, AI, LLM
and data analytics in construction — Subscribe now!

✕

🚀 Welcome to the future of data in construction!

You're taking your first step into the world of open data, working with normalized, structured data—the foundation of data analytics and modern automation tools.

By downloading, you agree to the DataDrivenConstruction terms of use 

Stay ahead with the latest updates on converters, tools, AI, LLM
and data analytics in construction — Subscribe now!

✕

🚀 Welcome to the future of data in construction!

You're taking your first step into the world of open data, working with normalized, structured data—the foundation of data analytics and modern automation tools.

By downloading, you agree to the DataDrivenConstruction terms of use 

Stay ahead with the latest updates on converters, tools, AI, LLM
and data analytics in construction — Subscribe now!

✕

🚀 Welcome to the future of data in construction!

You're taking your first step into the world of open data, working with normalized, structured data—the foundation of data analytics and modern automation tools.

By downloading, you agree to the DDC terms of use 

✕

🚀 Welcome to the future of data in construction!

You're taking your first step into the world of open data, working with normalized, structured data—the foundation of data analytics and modern automation tools.

By downloading, you agree to the DataDrivenConstruction terms of use 

Stay ahead with the latest updates on converters, tools, AI, LLM
and data analytics in construction — Subscribe now!

✕
DataDrivenConstruction offers workshops tested and practiced on global leaders in the construction industry to help your team navigate and leverage the power of data and artificial intelligence in your company's decision making.

Reserve your spot now to rethink your
approach to decision making!

✕

 

🚀 Welcome to the future of data in construction!

By downloading, you agree to the DataDrivenConstruction terms of use 

Stay ahead with the latest updates on converters, tools, AI, LLM
and data analytics in construction — Subscribe now!

✕
Have a question or need more information? Reach out to us directly!
Schedule a time to discuss your needs with our team.
Tailored sessions to help your team grow — let's plan together!
✕
Have you attended one of our workshops, read our book, or used our solutions? Share your thoughts with us!
Name
✕
Data Maturity Diagnostics

🧰 Data-Driven Readiness Check

This short assessment will help you identify your company's data management pain points and offer solutions to improve project efficiency. It takes only 1–2 minutes to complete and you will receive personalized recommendations tailored to your needs.

✕

Clean & Organized Data

Theoretical Chapters:

Practical Chapters:

What You'll Find on
DDC Solutions:

  • CAD/BIM to spreadsheet/database converters (Revit, AutoCAD, IFC, Microstation)
  • Ready-to-deploy n8n workflows for construction processes
  • ETL pipelines for data synchronization between systems
  • Customizable Python scripts for repetitive tasks
  • Intelligent data validation and error detection
  • Real-time dashboard connectors
  • Automated reporting systems
✕

Connect Everything

Theoretical Chapters:

Practical Chapters:

What You'll Find on
DDC Solutions:

  • CAD/BIM to spreadsheet/database converters (Revit, AutoCAD, IFC, Microstation)
  • Ready-to-deploy n8n workflows for construction processes
  • ETL pipelines for data synchronization between systems
  • Customizable Python scripts for repetitive tasks
  • Intelligent data validation and error detection
  • Real-time dashboard connectors
  • Automated reporting systems
✕

Add AI & LLM Brain

Theoretical Chapters:

Practical Chapters:

What You'll Find on
DDC Solutions:

  • CAD/BIM to spreadsheet/database converters (Revit, AutoCAD, IFC, Microstation)
  • Ready-to-deploy n8n workflows for construction processes
  • ETL pipelines for data synchronization between systems
  • Customizable Python scripts for repetitive tasks
  • Intelligent data validation and error detection
  • Real-time dashboard connectors
  • Automated reporting systems
052 Example of converting a PDF -document into a table
This website uses cookies to improve your experience. By using this website you agree to our Data Protection Policy.
Read more
×