https://github.com/ChrLipp/notes-import
Parses Apple notes SQLite databases
https://github.com/ChrLipp/notes-import
apple notes sqlite-database
Last synced: 9 months ago
JSON representation
Parses Apple notes SQLite databases
- Host: GitHub
- URL: https://github.com/ChrLipp/notes-import
- Owner: ChrLipp
- Created: 2018-10-08T06:28:10.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2024-03-09T10:24:05.000Z (almost 2 years ago)
- Last Synced: 2024-11-05T22:41:47.685Z (about 1 year ago)
- Topics: apple, notes, sqlite-database
- Language: Groovy
- Size: 180 KB
- Stars: 42
- Watchers: 1
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Apple Notes database parser
## About
Apple Notes data is stored in a SQLite database. Some month ago the data has been stored in the file
`/Users//Library/Containers/com.apple.Notes/Data/Library/Notes/NotesV7.storedata` respectively
`NotesV6.storedata` for the prior version. The notes have been stored in a HTML subset in clear text.
Then Apple kept the file but didn't update it anymore. Instead, a new location was used:
`/Users/christian/Library/Group Containers/group.com.apple.notes/NoteStore.sqlite`. The data is not
in clear text anymore. I needed the access badly, because my MacBook Pro was defect (spilled a bottle
of wine over it), my last backup was long ago and I didn't sync into iCloud.
So I found [apple_cloud_notes_parser](https://github.com/threeplanetssoftware/apple_cloud_notes_parser),
a Perl script which showed me how to parse the data. However, they have a small bug in calculating the
length of the data, so you will get only the first 27 chars or so of the note.
I decided to port the code to Java (ok, to Groovy) to be able to fix that. I could have adopted the
perl script but I thought I will have to strip the HTML fragments, but this was wrong. In the new
format, there are no HTML fragments any more. Anyway, even if I used it only once, the script evolved
based on feedback.
## Usage
Copy the database (location above) to the input folder, rename it to `NoteStore.sqlite` and start the
script with `./gradlew runScript`. You will receive a file per document in the output folder.
Afterwards I created empty notes and copy/pasted the notes back to Apple Notes again (at this time with
activated iCloud sync).
## Remark
I also tried to copy the whole database to my new MacBook, but this didn't work.
## Tested with
openjdk version "21.0.1" 2023-10-17
OpenJDK Runtime Environment Homebrew (build 21.0.1)
Groovy Version: 4.0.19
## Acknowledgement
- [Duncan Brown](https://github.com/duncanjbrown) provided a PR to obtain name, structure and creation timestamp for all notes
## Links
- Found another statement, didn't test it: https://github.com/ydkhatri/mac_apt/issues/46#issuecomment-766418508