TW5: How to use CreateTiddlersFromCSV

402 views
Skip to first unread message

LG

unread,
May 7, 2016, 11:18:23 PM5/7/16
to tiddl...@googlegroups.com
Hi! I've been desperately googling for half an hour and I cannot figure out how to use CreateTiddlersFromCSV. I copy data in and then it tells me I need to save. I cannot find a save button. I've tried dragging the URL into my TiddlyWiki, but the page just reloads and goes to that site. 

How do I do this?

Mal

unread,
May 8, 2016, 1:31:01 AM5/8/16
to TiddlyWiki
LG,

Someone more knowledgeable than me might chime in here, but I think CreateTiddlersFromCSV was a tool for Tiddlywiki Classic and is not available for TW5.  As far as I am aware, there is no native facility for importing CSV tiddlers into TW5.

Are you sure you are using TW5?

Regards,

Mal

LG

unread,
May 8, 2016, 3:31:22 PM5/8/16
to TiddlyWiki
Mal, 

Thank you for the update. I've been waiting on TW5 to get to where it is now for the past few years, so I definitely have snagged the empty.htm from the right site!

Best, 

LG 

Mark S.

unread,
May 9, 2016, 12:10:48 AM5/9/16
to TiddlyWiki
Here's a brand new, experimental tool to help you import CSV data. BE SURE TO BACKUP YOUR TW FILE BEFORE TRYING THIS!!

Unfortunately it is not a 100% automatic. That's why I refer to it as a helper. Someone who knows the innards of TW5 could probably fix up the code so that it does everything at once.

Drag and drop the attached json file into your TW. Save and reload your TW.

Follow the instructions in "How to use the CSV to TW/JSON helper". Basically you create a tiddler with your CSV data. The first row of the CSV data must have your field headers, and the field "title" is mandatory. If you want "created" or "modified" you will have to add your own date stamps at this point.

If the converter tiddler is successfully, your CSV data will appear below. You can copy and paste the converted JSON code into a separate file with a JSON extension, and then drag and drop it back into your TW to convert. This is the part that could use some more automation.

Good luck,
Mark

Project_CSV2JSON_v0.json

LG

unread,
May 9, 2016, 10:03:05 PM5/9/16
to TiddlyWiki
Hello, Mark!

I can confirm that this works. The first attempt failed. But I realized the issue was that I forgot to reload after importing then saving. Then it worked smoothly. 

I'm going to stress test it a bit more to see what else I can do. 

Thank you!

LG

LG

unread,
May 11, 2016, 11:48:37 PM5/11/16
to TiddlyWiki
Btw, do you have any tips on how to keep the text field from splitting? I was looking at TiddlyTools which said to write text which has a comma in it like so: "Here is some text, here is more." When I toss that in using your code, I get: 

"Here is some text    <--- body 
here is more   <--- custom field

I then tried writing it as ""Here is some text, here is more."" just to see if that produced a different response. Nope. 

Best, 

LG 

Mark S.

unread,
May 12, 2016, 12:01:12 AM5/12/16
to TiddlyWiki
Are all your fields surrounded in quotes? I forgot to mention that in my rush. Each data field should be surrounded with quotes and separated with commas with no space between. If that doesn't work, then some more hacking might be in order.

Mark

Amanda L. Goodman

unread,
May 12, 2016, 6:39:34 PM5/12/16
to tiddl...@googlegroups.com
Here's a sample line: 

Frank Hudson,English male,"husband of Sarah Owens, father of Nancy",1802,1860

--
You received this message because you are subscribed to a topic in the Google Groups "TiddlyWiki" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tiddlywiki/qabE7I41Hos/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/5748c255-9a84-4e54-a95d-8736551f12d8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Mark S.

unread,
May 12, 2016, 6:50:21 PM5/12/16
to TiddlyWiki

Ok, here's a slightly different version. Now it's really important that all the data lines have their fields enclosed with quotes. So your first two lines would look something like:

name,category,relationship,DOB,DOD
"Frank Hudson","English male","husband of Sarah Owens, father of Nancy","1802","1860"

HTH
Mark
Project_CSV2JSON_v0-1.json

Amanda L. Goodman

unread,
May 12, 2016, 10:45:28 PM5/12/16
to tiddl...@googlegroups.com
Looks my project is putting up quite the fight! That bit didn't help it either. :-)

title,tags,text,birth,death
"John Smith","English male","Explorer, Artist","1900","1981"


The final tiddler output: 

Title: "John Smith"
Tags: "English, male"  <--- notice that the comma separates two tags. Each kept one part of the quotes
Text: "Explorer
birth: Artist"
death: "1900


I hope you don't mind me sending you feedback on what I see. 

Best, 

LG

Mark S.

unread,
May 13, 2016, 12:40:50 AM5/13/16
to TiddlyWiki
Here's another version to try.

This version will ENABLE you to include tags with spaces (which I wouldn't advise personally...) Separate the tags with commas, but no spaces or quotes-within-quotes. Like:

title,tags,text,birth,death
"John Smith","English male,Therapist","Explorer, Artist","1900","1981"

In this version, definitely ALL fields (except header) must use double quotes. Failure to do so will result in truncated data. Probably need a more fail-safe approach. Later.

Only the field labeled "tags" will get this special treatment. In all other fields, commas will just be part of the field text.

If you want tags with commas in them ... ask someone else ;-)

Mark
Project_CSV2JSON_v0-2.json

Jan

unread,
May 13, 2016, 5:17:24 PM5/13/16
to tiddl...@googlegroups.com
Hi Mark,
How, did you guess my needs.
This is great, thanks a lot
Jan
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.

To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.

Mark S.

unread,
May 15, 2016, 2:11:47 PM5/15/16
to TiddlyWiki
This version of csv2json adds some error handling, giving you a message when it can't make sense of the input lines. Hopefully this will reduce the instances when the TW error handler will be invoked.


Mark

On Saturday, May 7, 2016 at 8:18:23 PM UTC-7, LG wrote:
Project_CSV2JSON_v0-3.json

LG

unread,
May 15, 2016, 3:45:58 PM5/15/16
to TiddlyWiki
Dear Mark, 

Using the version you sent the other day, Project_CSV2JSON_v0-2.json, and v0-3, I can report that it works. Things to note: 
  • tags have to be written with no spaces between them like so, "English,Explorer,Adventurer",
  • Each field defined in the first line needs to be present in each line afterwards. Otherwise, it throws errors
This is an amazing piece of work. Thank you. 

Best, 

LG 
Reply all
Reply to author
Forward
0 new messages