Microsoft Productivity
Microsoft Excel, Word, and PowerPoint toolsets.
#Microsoft productivity
Read and edit Office documents -- Excel workbooks, Word documents, and PowerPoint decks -- through Microsoft Graph.
MicrosoftExcelToolSet, MicrosoftWordToolSet, and MicrosoftPowerPointToolSet wrap document-format operations on top of Microsoft Graph. They share the auth and HTTP-client plumbing used by microsoft_graph connectors. Pass `drive_id to target a specific drive instead of /me/drive`.
All three toolsets are content-level editors -- they assume you already have the Graph drive-item ID for the workbook/document/deck. To find one by name, use MicrosoftFilesToolSet.search_files(include_ids=True) and pass the returned item dict into any of these tools. Each Excel / Word / PowerPoint tool accepts either a raw item-ID string or a Graph item dict and will pull the right ID out.
#MicrosoftExcelToolSet
from maivn_tools import MicrosoftExcelToolSet
connector = MicrosoftExcelToolSet(token=token_cache)#Agent-ready behavior
MicrosoftExcelToolSetis a worksheet/range/table editor -- useMicrosoftFilesToolSet.search_files(include_ids=True)to locate a workbook, then pass the returned item dict to any of these tools. The connector readsitem_id/file_id/workbook_id/idout of the dict.list_worksheets,get_used_range,list_tables, andget_table_rowsreturn the raw Graph response (e.g.{"value": [...]}); their size depends on the workbook. Uselist_worksheetsorget_used_rangeas a first call when you do not know a workbook's extent.create_sessionreturns{"id": <session_id>, ...}and selects persistence withpersist_changes.close_sessionaccepts that ID. The current range and worksheet methods do not accept a session ID or attach its header; using the session for those requests requires a custom HTTP integration. Closing a session is not a separate commit/discard choice.
file = files.search_files("Q4 forecast.xlsx", include_ids=True)["items"][0]
excel.list_worksheets(file)
excel.get_used_range(file, worksheet="Plan", values_only=True)#Destructive tools
delete_worksheet, clear_range, and delete_table are tagged destructive and require PermissionFlag.DELETE. clear_range's apply_to argument controls whether contents, formats, or both are cleared ("All" by default). Filter the destructive surface off the toolset with exclude_tags=["destructive"] to exclude tagged destructive methods.
#MicrosoftWordToolSet
from maivn_tools import MicrosoftWordToolSet
connector = MicrosoftWordToolSet(token=token_cache)Word does not expose structured editing through Microsoft Graph; this toolset covers the surface that does exist.
#Agent-ready behavior
MicrosoftWordToolSethas no list/search of its own -- useMicrosoftFilesToolSet.search_files(include_ids=True)to locate a document, then pass the returned item dict toget_metadata/download_content/convert_to/replace_content. The connector readsitem_id/file_id/idout of the dict.download_contentandconvert_toreturn `{"item_id": ..., "status": ..., "body": <bytes>}(withformatonconvert_to`). The body is raw bytes, not base64 -- if you need to ship it through a JSON-only tool channel, base64-encode it yourself.replace_contentsends the entire body in one request; for larger files useMicrosoftFilesToolSet.create_upload_session.
file = files.search_files("Launch plan.docx", include_ids=True)["items"][0]
word.convert_to(file, format="pdf")#Destructive tools
MicrosoftWordToolSet does not expose any DELETE-tagged tools. replace_content does overwrite the existing document in place -- treat it as destructive in workflow even though it is tagged WRITE (filtering on exclude_tags=["destructive"] will not remove it). For file deletion, use MicrosoftFilesToolSet.
#MicrosoftPowerPointToolSet
from maivn_tools import MicrosoftPowerPointToolSet
connector = MicrosoftPowerPointToolSet(token=token_cache)#Agent-ready behavior
MicrosoftPowerPointToolSethas no list/search of its own -- useMicrosoftFilesToolSet.search_files(include_ids=True)to locate a deck, then pass the returned item dict toget_metadata/download_content/convert_to/list_thumbnails/replace_content. The connector readsitem_id/file_id/presentation_id/idout of the dict.download_contentandconvert_toreturn `{"item_id": ..., "status": ..., "body": <bytes>}(withformatonconvert_to). The body is raw bytes;convert_toacceptspdforjpg` only.replace_contentsends the entire body in one request; for larger files useMicrosoftFilesToolSet.create_upload_session.
file = files.search_files("All-hands deck.pptx", include_ids=True)["items"][0]
powerpoint.list_thumbnails(file)#Destructive tools
MicrosoftPowerPointToolSet does not expose any DELETE-tagged tools. replace_content does overwrite the existing deck in place -- treat it as destructive in workflow even though it is tagged WRITE (filtering on exclude_tags=["destructive"] will not remove it). For file deletion, use MicrosoftFilesToolSet.