Notes Android app - mass export

Hello all.

Today I have suffered from a catastrophic failure that wiped around 20 years of my data.

Some of it is recoverable some is not. I learned that my notes are not in the backup, but I can read them on my Android phone.

Question: is there any way to export all of them bulk (around 500 in total) or I should do it one by one (share each note and save it as txt somewhere)?

NC Notes version is 4.5.2 if that helps.

I have already checked Android/data directory on my internal storage and have found nothing that seems to be related to Note app, thus I might have missed that.

Any ideas?

First of all, all Android apps store their data in private folders which are not accessible without root access. The shared “data” folder is only used if an app has the permission to store information in the shared storage - but since this is also a security risk (other apps may also access this storage) it is usually not done this way.

And the next issue is, that the Notes app is intended to edit notes on a Nextcloud server. So under normal conditions all notes are stored on a server anway, so there is no use case to export the data of the app and thus the app does not have such a feature.

You may try to create a backup to your computer using adb and tools like this: GitHub - mrrfv/open-android-backup: Back up your device without vendor lock-ins, using insecure software or root. Supports encryption and compression out of the box. Works cross-platform.

1 Like

Thank you so much for the reply.
I am not sure that the Open Android Backup will backup app’s data but better then nothing.

Ok, for anyone interested.

you will need root to perform this

The it.niedermann.owncloud.notes app has the “databases” directory in it’s data dir (located at the /data/data/it.niedermann.owncloud.notes). Inside one will find 3 files:
OWNCLOUD_NOTES
OWNCLOUD_NOTES-shm
OWNCLOUD_NOTES-wal

Those are sqlite3 data bases. As such the following algorithm can be used for a mass export:

  1. Get access to the /data/data/it.niedermann.owncloud.notes/databases folder
  2. Copy all OWNCLOUD_NOTES files somewhere you can access them without root
  3. Copy files to your PC.
  4. On PC, navigate to the folder the files are stored in and run
$ sqlite3 OWNCLOUD_NOTES

You will be presented with the SQLITE prompt, so run the following commands:

.headers on
.mode csv
.output notes.csv
SELECT id, title, content, modified FROM Note;
.output stdout
.quit

It will look alike so:

$ sqlite3 OWNCLOUD_NOTES
SQLite version 3.49.0 2025-02-06 11:55:18
Enter ".help" for usage hints.
sqlite> .headers on
sqlite> .mode cvs
Error: mode should be one of: ascii box column csv html insert json line list markdown qbox quote table tabs tcl
sqlite> .mode csv
sqlite> .output notes.csv
sqlite> SELECT id, title, content, modified FROM Note;
sqlite> .output stdout
sqlite> .quit
  1. Now check your directory from where you ran sqlite3: you should see file named notes.csv.

If the mentioned file is there my congrats, you have your data exported.

1 Like

Also a ‘one note = one file’ is possible.
(C) OpenAI

import sqlite3, os

conn = sqlite3.connect("OWNCLOUD_NOTES")
cur = conn.cursor()

os.makedirs("notes", exist_ok=True)

for id, title, content in cur.execute("SELECT id, title, content FROM Note"):
    safe = "".join(c for c in title if c.isalnum() or c in " -_")[:60]
    with open(f"notes/{id}_{safe}.txt", "w", encoding="utf-8") as f:
        f.write(content)

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.