kometenstaub / csv-to-md Goto Github PK
View Code? Open in Web Editor NEWBatch CSV to Markdown converter.
License: MIT License
Batch CSV to Markdown converter.
License: MIT License
For example, if I have:
key,value
Alice,"value1,value2,"value,3,with,comma""
then the output will be
Alice:: [[value1]] [[value2]] [[value,3,with,comma]]
not
Alice:: [[value1]] [[value2]] [[value]] [[3]] [[with]] [[comma]]
This can even be trickier if the value also have double quote in it, e.g. value,"4",with,comma
will be written in the CSV as "value,""4"",with,comma"
In my files I have quotes (they happen to be double) around text in order to preserve commas. These are removed in the body but remain the YAML. It would be great to have an option to remove surrounding double (or single) quotes from YAML.
Thanks
Hi @kometenstaub , sorry to post an issue, here, but I couldn't find any other way to contact you. Just wanted to thank you for your effort in creating this. Although I didn't make full use of this, it did help me to import a bunch of items into Joplin from a CSV file that I had created to import the list into Todoist (but then changed my mind, and wanted to send them to Joplin instead). If it wasn't for this tool, I would have had to create those notes manually. Thanks.
It would be convenient to have an option to omit columns.
I had a .csv file with three columns. I needed to create .md files with first column as the filename, second column as frontmatter and the final column as unformatted content. I couldn't figure out a way to do this with the latest version.
I might be missing this, is there a way to have the formatting for Column headers and then the content in each row have normal text formatting? The documentation I'm putting together, each row in the csv is the detailed data for the column header.
idea for new user adoption
This is useful in Dataview queries, since with
key:: foo bar
you get a string, while with
key:: foo
key:: bar
you get a list ["foo","bar"]
. This would also be easier to read, if the value is sentence-long
not only support frontmatter YAML and normal markdown, but also inline YAML (YAML keys for every column of each row, two colons, the markdown formatted content for it.)
Title:: [[king]]
Thanks for your work here.
I would prefer to have the formatting inside the CSV column names. This would make it easy to have different CSV files with different formatting. It would also avoid the need to use or set up the setting file.
For example
Name (H1) | Location (H2) | Age (BO) | etc
Result:
Age
I suppose that before the script exits it should save the current setting into saved_settings.py? It doesn't do that in my case. Also, there is no log as well
I would like to have a mix of fields inside and outside YAML, for example:
Input only 2 columns in YAML:
alias | tags | Name | Location
Name:: name
Location:: location
If you want them in both then just duplicate a column.
Another approach would be to include YAML in the column name, eg:
alias (yaml) | tags (yaml) | Name | Location
PS D:\GitHub\Obsidian\csv-to-md> python csv_to_md-file.py
saved_settings.py is already present
Do you want to load saved settings? Enter "y" for yes and "n" for no: y
Which settings do you want to choose? Please enter the name of the dictionary in saved_settings.py: save2
These are your selected settings: {'addYAML': 'n', 'column': {0: ['h2'], 1: ['ul'], 2: ['ta'], 3: ['ta', 'y', ','], 4: ['oc'], 5: ['ml'], 6: ['ta'], 7: ['ut'], 8: ['ut']}, 'delimiter': ',', 'fileNameCol': [0, 1], 'fileNameColSeparator': ' -- ', 'fileNameLength': 50, 'inlineYAML': 'y'}
Found file: Khảo sát-Grid view.csv
Traceback (most recent call last):
File "D:\GitHub\Obsidian\csv-to-md\csv_to_md-file.py", line 390, in <module>
startScript.choices()
File "D:\GitHub\Obsidian\csv-to-md\csv_to_md-file.py", line 43, in choices
self.mdChoices()
File "D:\GitHub\Obsidian\csv-to-md\csv_to_md-file.py", line 64, in mdChoices
instanceFile.makeMdFiles()
File "D:\GitHub\Obsidian\csv-to-md\csv_to_md-file.py", line 213, in makeMdFiles
if len(self.settings["column"][el]) > 1:
KeyError: 9
The script runs successful, but there is not output in the data folder. The log it only says generally. How to know what went wrong?
./data/Không gian làm việc chung.md -- Error.
./data/Phòng họp riêng.md -- Error.
./data/Quán có phòng riêng.md -- Error.
./data/Quán không có phòng riêng.md -- Error.
./data/Địa điểm công cộng.md -- Error.
./data/Nhà riêng.md -- Error.
./data/Không gian làm việc chung.md -- Error.
./data/Phòng họp riêng.md -- Error.
./data/Quán có phòng riêng.md -- Error.
./data/Quán không có phòng riêng.md -- Error.
./data/Địa điểm công cộng.md -- Error.
./data/Nhà riêng.md -- Error.
Line 261 in 05f2b3f
Thank you for sharing this. I really need this functionality, but when I run the python script I get this:
File "csv_to_md-file.py", line 17
self.settings:dict = {}
^
SyntaxError: invalid syntax
Can you advise me what to do please?
It would be great to be able to export a folder of notes from within Obsidian into a CSV so they can be edited on mass or used for analytics within CSV apps, eg. Google sheets and Excel. If used for editing then consideration would have to be given to maintaining consistency (round tripping) through export and re-import. I would value this highly.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.