Importing Google Keep notes difficulty
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 738
- Forks
- 162
- Avg merge
- 6h 2m
- Merged PRs (30d)
- 35
Description
I tried to use the code to load in Google Keep notes, and it didn't do a great job. I wrote up something quick myself that takes care of check lists, text, and what I tried to make with attachments. It's shown below:
import os
import json
import shutil
os.makedirs("markdown/attachments")
for filename in os.listdir('Keep'):
if filename.split('.')[-1] == 'json':
data = json.load(open("Keep/"+filename, 'r', encoding="utf-8"))
if "labels" in data:
category_folder = data["labels"][0]['name'] #Uses first label...
if not os.path.exists("markdown/"+category_folder):
os.makedirs("markdown/"+category_folder)
else:
category_folder = ""
if data["title"] == "":
md_name = filename.split(".")[0]
else:
md_name = data["title"].replace('/',"_")
for char in ['\\','+','=','?','(',')','<','>',':','*','"','|']:
md_name = md_name.replace(char,"_")
with open("markdown/"+category_folder+'/'+filename.split(".")[0]+".md", 'w+', encoding="utf-8") as md:
# atachments and images
if 'attachments' in data:
if len(data['attachments']) > 0:
for attachment in data['attachments']:
attach_file = attachment["filePath"]
if attach_file not in os.listdir('Keep'):
attach_file = attach_file[:-3]+"png"
if attach_file not in os.listdir('Keep'):
attach_file = attach_file[:-3]+"jpg"
if attach_file not in os.listdir('Keep'):
attach_file = attach_file[:-3]+"3gp"
md.write("\n")
shutil.copyfile("Keep/"+attach_file, "markdown/attachments/"+attach_file)
# free text
if "textContent" in data:
for line in data["textContent"].split('\n'):
md.write(line+'\n')
# lists
if "listContent" in data:
for item in data["listContent"]:
if item["isChecked"] == False:
md.write("-[ ] "+item["text"]+"\n")
elif item["isChecked"] == True:
md.write("-[x] "+item["text"]+"\n")
Only issue I had is that when I load them all in. It actually works pretty okay with the lists, but the attachments can't be found by the notes app, even though I put them in the appropriate hidden attachment folder. It also seems that the notes app is randomly making new attachment folders, perhaps it's looking for them? If you could guide me about the formatting for attachments I'd really appreciate it so I can import my many notes appropriately!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the Google Keep import with the provided script and inspect how the generated attachment paths and hidden folders are resolved by the notes app. The work is done when imported notes consistently locate and display their attachments without creating unexpected folders.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- markdown
- Domain
- content
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100