thomast
thomast

Reputation: 23

Get content from several Pages and Sections from OneNote to Excel

I am very new to all of this so please bare with me.

I have a OneNote Notebook with several Sections each containing hundreds of pages. I need to retrieve all the content of the pages (while keeping the structure of the page titles / section titles) and end up with that content in a somewhat usable state in Excel. Of course, doing so manually will take me weeks. That's why I'm looking for an automated/semi-automated approach.

Is there a way to do that? What do I need to look into? I haven't found an answer on the interned but I guess I may need to use the OneNote API? Maybe find a way to export the OneNote content into .csv to then process it in Excel? Maybe the OneNote content can be retrieved directly by a macro in Excel?

What would you look into to achieve my goal?

Thank you for reading.

Upvotes: 0

Views: 1210

Answers (1)

codeye
codeye

Reputation: 627

The OneNote API/Graph API can get sections and pages

GET https://graph.microsoft.com/v1.0/me/onenote/notebooks/{id}/sections

GET https://graph.microsoft.com/v1.0/me/onenote/sections/{id}/pages$count=true&$top=100

There may be a limitation to the number of pages that can be accessed by the API (recently introduced?). Then a further call to get individual page content:

GET https://graph.microsoft.com/v1.0/me/onenote/pages/{id}/content[?includeIDs=true]

An alternative may be to use this rust OneNote notebook parser - creates html files.

Upvotes: 0

Related Questions