microsoftgraph / msgraph-sdk-python

MIT License
380 stars 56 forks source link

Excel Workbook API returns empty rows in additional_data #623

Closed DanarajMSFT closed 1 month ago

DanarajMSFT commented 8 months ago

Request is successful when calling the MSGraph Excel API - but the additional_data field is always empty. Calling the Excel Graph API to read Excel workbook table rows.

This is the code:

drive = await client.drives.by_drive_id('id').items.by_drive_item_id('id').workbook.tables.by_workbook_table_id('1').rows.item_at_with_index(6).get(request_configuration = request_configuration)

The additional_data is always {} even though my Excel file has over 6K rows. EAPI

ejbt11 commented 7 months ago

Python: 3.10.12 msgraph-core==1.0.0 msgraph-sdk==1.2.0

Even in delegated access mode. it can only see and post blank/empty rows.

Using row.add.post with AddPostRequestBody or using row.post with WorkbookTableRow produces an error: 'list' object has no attribute 'serialize'.

dennistran314 commented 3 months ago

Python: 3.10.12 msgraph-core==1.0.0 msgraph-sdk==1.2.0

Even in delegated access mode. it can only see and post blank/empty rows.

Using row.add.post with AddPostRequestBody or using row.post with WorkbookTableRow produces an error: 'list' object has no attribute 'serialize'.

Have u solved the issue? I keep getting the the error that 'list' object has no attribute 'serialize'. I have tried making it into a json, dictionary, set but nothing works @ejbt11

ejbt11 commented 3 months ago

Python: 3.10.12 msgraph-core==1.0.0 msgraph-sdk==1.2.0 Even in delegated access mode. it can only see and post blank/empty rows. Using row.add.post with AddPostRequestBody or using row.post with WorkbookTableRow produces an error: 'list' object has no attribute 'serialize'.

Have u solved the issue? I keep getting the the error that 'list' object has no attribute 'serialize'. I have tried making it into a json, dictionary, set but nothing works @ejbt11

I'm using the direct REST API call temporarily getting the needed header and parameter values from the objects in this SDK. the SDK itself, specifically for excel, seems incomplete or ridden with bugs. @dennistran314 We might have to wait for the next version.

shemogumbe commented 2 months ago

Hello, Thanks for raising this, Looks like we have two issues here.

  1. @DanarajMSFT has an issue with querying as additional data is empty even when his excell has data in it's rows and columns.
  2. @ejbt11 and @dennistran314 have issues with posting cell data via the SDK, right?

Also, from preliminary investigations, the drive item is not recognised as a workbok, thus does not have workbook properties such as tables/worksheets etc and graph properties

print(drive)
        print(f"Drve item name : {drive.name}")
        print(f"Drive item workbook : {drive.workbook}")

        if drive.file and drive.file.mime_type == 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet':
            print("The drive item is a workbook.")
        else:
            print("The drive item is not a workbook.")

Gives

DriveItem(additional_data={'@odata.context': 'https://graph.microsoft.com/v1.0/$metadata#Collection(driveItem)/$entity', '@microsoft.graph.downloadUrl': 'https://yygbp-my.sharepoint.com/personal/shemtee_yygbp_onmicrosoft_com/_layouts/15/download.aspx?UniqueId=f6a15dcc-ea89-4b63-8ac4-41bfeed5a6be&Translate=false&tempauth=v1.eyJzaXRlaWQiOiI4MzNjMTQ2Yi0yMTUwLTQxMTItYTZlYy03Yjc2NjM3ZjAwODciLCJhcHBfZGlzcGxheW5hbWUiOiJzaGVtX3Nka190ZXN0IiwiYXVkIjoiMDAwMDAwMDMtMDAwMC0wZmYxLWNlMDAtMDAwMDAwMDAwMDAwL3l5Z2JwLW15LnNoYXJlcG9pbnQuY29tQDVjOGRhN2I5LWM3YmEtNGIxOC05ZTY2LThkNTYwNDY5NDI2NSIsImV4cCI6IjE3MjQzMzA1ODkifQ.CgoKBHNuaWQSAjY0EgsIsKnAkLSqoT0QBRoMNDAuMTI2LjMxLjk5KixHc3BCNVBzbXd3UW1vZjNtR2hpWVdBTklaZ1A0Vlo4Z3FtcjN3QkNsK3VnPTCeATgBQhChSMEqegAAACrv2sEgMu55ShBoYXNoZWRwcm9vZnRva2VuegExugHTAW15YXBwZm9sZGVyLndyaXRlIHNlbGVjdGVkc2l0ZXMgZmlsZXMuc2VsZWN0ZWRvcGVyYXRpb25zIGFsbHNpdGVzLnJlYWQgYWxsc2l0ZXMud3JpdGUgYWxsc2l0ZXMubWFuYWdlIGFsbGZpbGVzLndyaXRlIGFsbGZpbGVzLnJlYWQgbGlzdHMuc2VsZWN0ZWRvcGVyYXRpb25zIGFsbHNpdGVzLmZ1bGxjb250cm9sIGFsbHByb2ZpbGVzLndyaXRlIGFsbHByb2ZpbGVzLnJlYWTCAUllOGFiM2U4OC04NGFhLTQzOTktYTRlNi0wY2U0YjM1NjMyN2NANWM4ZGE3YjktYzdiYS00YjE4LTllNjYtOGQ1NjA0Njk0MjY1yAEB.wzk6Xt8MyeGJZW2U-vMBkKwk0x_gVa4fbfwne4H0Hfo&ApiVersion=2.0'}, id='01RUWSUNWMLWQ7NCPKMNFYVRCBX7XNLJV6', odata_type='#microsoft.graph.driveItem', created_by=IdentitySet(additional_data={}, application=None, device=None, odata_type=None, user=Identity(additional_data={'email': 'SHEMTEE@yygbp.onmicrosoft.com'}, display_name='Shem Ogumbe', id='76b4a63a-8dee-428d-b39d-404d14a7ee96', odata_type=None)), created_by_user=None, created_date_time=DateTime(2024, 8, 22, 9, 18, 51, tzinfo=Timezone('UTC')), description=None, e_tag='"{F6A15DCC-EA89-4B63-8AC4-41BFEED5A6BE},7"', last_modified_by=IdentitySet(additional_data={}, application=None, device=None, odata_type=None, user=Identity(additional_data={'email': 'SHEMTEE@yygbp.onmicrosoft.com'}, display_name='Shem Ogumbe', id='76b4a63a-8dee-428d-b39d-404d14a7ee96', odata_type=None)), last_modified_by_user=None, last_modified_date_time=DateTime(2024, 8, 22, 9, 22, 42, tzinfo=Timezone('UTC')), name='Proj management.xlsx', parent_reference=ItemReference(additional_data={}, drive_id='b!axQ8g1AhEkGm7Ht2Y38AhzIGJDVp6iNNh8Dx8AnFpCdiL9C2pDizRK99X3lsfUGp', drive_type='business', id='01RUWSUNXM2HNKKQAWCRC3CN4P2RT7AWQK', name='myprojects', odata_type=None, path='/drives/b!axQ8g1AhEkGm7Ht2Y38AhzIGJDVp6iNNh8Dx8AnFpCdiL9C2pDizRK99X3lsfUGp/root:/myprojects', share_id=None, sharepoint_ids=None, site_id='833c146b-2150-4112-a6ec-7b76637f0087'), web_url='https://yygbp-my.sharepoint.com/personal/shemtee_yygbp_onmicrosoft_com/_layouts/15/Doc.aspx?sourcedoc=%7BF6A15DCC-EA89-4B63-8AC4-41BFEED5A6BE%7D&file=Proj%20management.xlsx&action=default&mobileredirect=true', analytics=None, audio=None, bundle=None, c_tag='"c:{F6A15DCC-EA89-4B63-8AC4-41BFEED5A6BE},6"', children=None, content=None, deleted=None, file=File(additional_data={}, hashes=Hashes(additional_data={}, crc32_hash=None, odata_type=None, quick_xor_hash='LYW16MFKSaoPoFYft6HZXeQLmiA=', sha1_hash=None, sha256_hash=None), mime_type='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', odata_type=None, processing_metadata=None), file_system_info=FileSystemInfo(additional_data={}, created_date_time=DateTime(2024, 8, 22, 9, 18, 51, tzinfo=Timezone('UTC')), last_accessed_date_time=None, last_modified_date_time=DateTime(2024, 8, 22, 9, 22, 42, tzinfo=Timezone('UTC')), odata_type=None), folder=None, image=None, list_item=None, location=None, malware=None, package=None, pending_operations=None, permissions=None, photo=None, publication=None, remote_item=None, retention_label=None, root=None, search_result=None, shared=None, sharepoint_ids=None, size=10147, special_folder=None, subscriptions=None, thumbnails=None, versions=None, video=None, web_dav_url=None, workbook=None)
Drve item name : Proj management.xlsx
Drive item workbook : None
The drive item is a workbook.

We have a non-type, this could be the reason for missing properties such as additional_data and post properties.

Also, do you mind sharing the structure of your Workbook, - the worksheets, tables, sheets, rows, with sample data?

shemogumbe commented 2 months ago

Duplicate for https://github.com/microsoftgraph/msgraph-sdk-python-core/issues/511