How do I create a collection from text file(s) that are all in a specific format

I am trying to create a collection with my book list. Something like the following:

Since I have hundreds of items in my text files, it is not feasible to add them one by one. My usual format is [filename = category/genre] >> each line is formatted as title - author(s) #tags_like_status.

I can code up something that can create new files with any specific formatting for all the entries, but how can I import it to a collection?

Any help is appreciated. Thank you.

Are all of these files? Just use a set (query by object type and choose File) instead and filter it.

What exactly is format supposed to mean in this case? If it’s all in the title, you can just filter that.

In the image shared, they are just entries in a collection in Anytype.

As for the files and formatting:

  1. I have multiple text files in my PC with file names like math, cs, philosophy, fiction, etc
  2. In those files, each line represents a book, in the format:
    book name - author(s) #tag_for_status

I hope this makes it a little clear.

Just use a set (query by object type and choose File) instead and filter it.

Please elaborate

  1. Compress all of your files into a .zip file

  2. Import txt files
    image

  3. Choose the .zip file

  4. A new collection will be created with all of the files in the .zip file added to it

Thanks a lot for this. I will try to import a subset of files and see how modifying the entries works out.

This solved one of my queries, thank you. now i have the text files as pages in anytype.

now how can i create a table out of them, with columns like author, tags, status, etc so that i can filter as needed?

again thanks for the import zip trick.

@sihoc61525
You’re more than welcome!

If I get that right, you would just have to use relations, see that + button besides “Tag” relation? You can click it to add a new relation whether it’s an “Author” or whatever you prefer.

ok, i get now what i have to do. the add relation feature will add a col to collection table. in my case, the rows in the table are file names, but what i want them to be are book titles.

i tried a few things, importing/exporting markdown, json with tags differently and other things.

what finally seemed to work is creating a csv and importing that, it took all cols separately.

thank you so much for all your help.

I have a last question if you do not mind. i have setup the android app as well, and the sync works flawlessly right now. can you please tell me how exactly are you logging multi-device/syncing? are you sending it via a server or is it happening p2p, directly from my laptop to me phone?

2 Likes

Glad you figured it out. As for the syncing, there are 3 options:

  1. Backup node: Device 1 <> Anytype node <> Device 2
  2. Local sync (local network) : Device 1 <> Device 2
  3. Self-hosted backup node: Device 1 <> Node <> Device 2

Since it’s a new account, you are using our Anytype network to backup and sync between your devices. You can also self-host or just use the local sync as @Hexara already mentioned.
You can find more info here.

1 Like

Thanks, this is what my question was.

1 Like