Hi Luzuko Yena,
Yes, it is possible to extract only tables using Azure AI Document Intelligence.
Azure AI Document Intelligence provides multiple models to analyze documents, such as:
· Prebuilt Layout Model
· Prebuilt Document Model
· Custom Models
To extract only tables, you should use the Layout Model, which is designed for this purpose.
What it does:
· Extracts text lines
· Extracts tables (structure + cell content)
· Extracts selection marks (checkboxes)
It does not extract key-value pairs or entities — perfect if you're only focused on layout elements like tables.
To Use (via REST API / SDKs / Azure Portal)
Example using Python SDK:
from azure.ai.formrecognizer import DocumentAnalysisClient
from azure.core.credentials import AzureKeyCredential
endpoint = "https://.cognitiveservices.azure.com/"
key = ""
document_analysis_client = DocumentAnalysisClient(
endpoint=endpoint, credential=AzureKeyCredential(key)
)
# Use layout model
poller = document_analysis_client.begin_analyze_document(
"prebuilt-layout", document=open("your_file.pdf", "rb")
)
result = poller.result()
# Extract tables only
for table in result.tables:
print(f"\nTable with {table.row_count} rows and {table.column_count} columns")
for cell in table.cells:
print(f"Cell [{cell.row_index}, {cell.column_index}] - content: '{cell.content}'")
Hope this helps. Do let me know if you any further queries.
If this answers your query, do click Accept Answer and Yes for was this answer helpful. And, if you have any further query do let us know.
Thank you!
Answer from Prashanth Veeragoni on learn.microsoft.comHi Luzuko Yena,
Yes, it is possible to extract only tables using Azure AI Document Intelligence.
Azure AI Document Intelligence provides multiple models to analyze documents, such as:
· Prebuilt Layout Model
· Prebuilt Document Model
· Custom Models
To extract only tables, you should use the Layout Model, which is designed for this purpose.
What it does:
· Extracts text lines
· Extracts tables (structure + cell content)
· Extracts selection marks (checkboxes)
It does not extract key-value pairs or entities — perfect if you're only focused on layout elements like tables.
To Use (via REST API / SDKs / Azure Portal)
Example using Python SDK:
from azure.ai.formrecognizer import DocumentAnalysisClient
from azure.core.credentials import AzureKeyCredential
endpoint = "https://.cognitiveservices.azure.com/"
key = ""
document_analysis_client = DocumentAnalysisClient(
endpoint=endpoint, credential=AzureKeyCredential(key)
)
# Use layout model
poller = document_analysis_client.begin_analyze_document(
"prebuilt-layout", document=open("your_file.pdf", "rb")
)
result = poller.result()
# Extract tables only
for table in result.tables:
print(f"\nTable with {table.row_count} rows and {table.column_count} columns")
for cell in table.cells:
print(f"Cell [{cell.row_index}, {cell.column_index}] - content: '{cell.content}'")
Hope this helps. Do let me know if you any further queries.
If this answers your query, do click Accept Answer and Yes for was this answer helpful. And, if you have any further query do let us know.
Thank you!
Hey Luzuko Yena,
Thanks for asking on Microsoft Q&A!
You can pull tables using Azure AI Document Intelligence with the prebuilt-layout model. It grabs tables, text, and other stuff, but there’s no direct way to get only tables from the API. Just take the JSON response and pick out the "tables" section in your code. For example, in Python, you’d grab the rows, columns, and cell data from "tables", skipping everything else.
Hope this does the trick! If it helps, please upvote and mark as accepted. Thanks!
References:
- Document layout analysis - Document Intelligence
- Use Document Intelligence client library or REST API
How to extract table specific values in Document Intelligence Custom Extraction Model
Using Azure AI Document Intelligence, custom extraction model. How do I merge tables split over 2 pages?
Azure AI Document Intelligence - how to extract data when item or table is not consistently on the same page???
AI Document Extraction on Azure - Options, Comparison & Recommendations for Invoice/Contract Processing
Hi all...
I am building a custom extraction model which is based on PDF reports. The first several pages are consistent, and I can repeatedly get the key data from the fields.
However, there is an appendix in each PDF which for example appears on page 20 in one report, but on page 22 on another due to the amount of information that is present in the document in various sections.
To complicate the matter further this appendix is often running over several pages.
When training the model fails to find the appendix in any of the cases. I'm guessing this is because I am assigning a field to page 20 in one document and page 22 in another??? Is there a method of having the appendix identified without the page number being considered?
Tony