rowSpan and colSpan of cell are always 1, by google documentai processor

72 views
Skip to first unread message

dio lee

unread,
Dec 10, 2020, 5:04:40 AM12/10/20
to Google Cloud Developers
import json 
ifp = open('log.json') 
response = json.load(ifp) 

for bodyRow in response['document']['pages'][0]['tables'][1]['bodyRows']: 
    for cell in bodyRow['cells']: 
        print(f'rowSpan is {cell["rowSpan"]}]')

log.json is the ocr and parsed result of table.

I write this python script to parse this table with Processors "Form parser" by google documentai_v1beta3, want to find out the rowSpan of all cell.

There are some cells span 2 or 3 rows, but I always get the result 1. Anyone know anything about that? Is that a bug of documentai_v1beta3?Untitled.png

Kevin Tielve

unread,
Dec 14, 2020, 12:08:52 PM12/14/20
to Google Cloud Developers
TBH, I am not sure what you are trying to achieve exactly. The Form Parser is used to send a processing request for a form document (PDF, TIFF, GIF). Is your document PDF, TIFF or GIF? Are the fields you are trying to catch present in the json output from the Form Parser?
Reply all
Reply to author
Forward
0 new messages