Giter Club home page Giter Club logo

domhel / csv2logseq_block Goto Github PK

View Code? Open in Web Editor NEW

This project forked from arrowyz01/csv2logseq_block

0.0 0.0 0.0 72 KB

Python script that can read csv file and output a markdown file containing logseq block and block properties (from csv data), and a basic query script to generate a table query (like the format in csv file). The goal is to simulate notion table database in logseq. Also come with a script to reverse!

License: GNU General Public License v3.0

Python 100.00%

csv2logseq_block's Introduction

csv2logseq_block

Hello everone, I like notion database that can create from csv, I also like logseq. But I don't like that notion put my data online. So I try to do something with my basic python knowledge to make a "notion-like table database" in logseq. Feel free to try.

This is a Python script that can read csv file and output a markdown file containing logseq block and block properties (from csv data), and a basic query script to generate a table query (like the format in csv file). The goal is to simulate notion table database in logseq.

Also come with a script to reverse!

I try to fix some problem, also make the usage a little bit easier... maybe not?

What you need to prepare

  • python3

    which python

    python -V

  • make sure you have pandas installed, use follow command to check

    pip list

  • or install pandas

    pip install pandas

  • find your logseq vault

quick start

  • convert '.csv' to '.md' with logseq block structures and a query table with "Table name".

    • download and put 'csv2logseq.py' in the same folder as '.csv' file you want to convert, use shell and 'cd' to that folder.
    • type the command, you need to change to your '.csv' filename and your "Table name". Please note that: the "" is necessary for the table name of query table.

      python csv2logseq.py filename.csv "Table name"

    • it will read the '.csv', and output a '.md' file with logseq block/block properties structrue in the same folder.
    • then you can copy the output '.md' file to your logseq vault (ie. in "pages" folder).
  • convert '.md' with logseq block structures to '.csv'.

    • if you want to reverse the process, ie, read '.md' file with logseq block/block properties structrue and output a '.csv' file, please use 'logseq_block2csv.py'.
    • just download and put it in the same folder as the '.md' file you want to convert, use shell and 'cd' to that folder.
    • type the command, you need to change to your '.md' filename.

      python logseq_block2csv.py filename.md

    • the script will output the '.csv' file in the same folder as well.
    • but please note that: the script is very sensitve to the format in '.md' file, you'd better make the '.md' file as neat as possible.

Image

  • expand the major block

expand

  • collapse the major block

fold

  • click one block from query table, you can create new page from [[block title]].

block

Video

  • csv2md
csv2md.mp4
  • md2csv
md2csv.mp4

Advanced use

  • go to the 'advanced' folder and download a little bit different 'csv2logseq.py'
  • add this script into your $PATH (or put it in a folder that already in your $PATH)
  • change a little bit in the script
    • 1st line: path to your python
    • 22th line: path to your logseq vault folder
  • now you can use the follow command in any folder that contains csv files and the output file will directly appear in your logseq vault folder

    csv2logseq.py filename.csv "Table name"

csv2logseq_block's People

Contributors

arrowyz01 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.