11

I am trying to read .one file(OneNote files) and want to write its content into a text file, but didn't find a single way to do it using Python. Please help me with this.

Anshul
  • 113
  • 1
  • 7
  • Possible duplicate of https://stackoverflow.com/questions/34622471/how-to-access-download-onenote-notebook-with-python – Jorge Lavín Oct 15 '18 at 09:35
  • 2
    @JorgeLavín am able to fetch OneNote into my local but not able to read its content.By looking at API didn't find a way to read. Please suggest any possible solution. – Anshul Oct 15 '18 at 10:47
  • one note contains not just text, they have many other formatted contents. so do you really only need the text in it? – Lei Yang Jul 14 '21 at 01:37

3 Answers3

1

This isn't Python, but for other internet voyagers trying to escape Microsoft's iron grip this PowerShell script is pure magic.

https://passbe.com/2019/bulk-export-onenote-2013-2016-pages-as-html/

Jonathan
  • 648
  • 4
  • 13
  • 34
0

Try to get the content of your notes calling:

./me/onenote/pages/1-1c13bcbae2fdd747a95b3e5386caddf1!1-xxxxxxxx-xxxx-xxxx-xxxxxxxxxxxx/content?includeIDs=true&includeInkML=true&preAuthenticated=true

It will give you text/html, which you can parse with https://pypi.org/project/lxml/

Kfcaio
  • 442
  • 1
  • 8
  • 20
0

I didn't find a good way to decode .one file. But I find another way to workaround it.

  1. Install OneNote 2016 and sync the contents.
  2. Install the Evernote legacy version
  3. Import data from OneNote to Evernote. (There's a button on GUI).
  4. Export notes to html from Evernote.
  5. Then you can do whatever you want. Yeah!
Hanzhou Tang
  • 351
  • 2
  • 6