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

 

On Thursday, May 12, 2016 at 7:45:28 PM UTC-7, LG wrote:
>
> 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
>
> On Thu, May 12, 2016 at 6:50 PM, 'Mark S.' via TiddlyWiki <
> tiddl...@googlegroups.com <javascript:>> wrote:
>
>>
>> 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
>>
>> On Thursday, May 12, 2016 at 3:39:34 PM UTC-7, LG wrote:
>>>
>>> Here's a sample line: 
>>>
>>> Frank Hudson,English male,"husband of Sarah Owens, father of 
>>> Nancy",1802,1860
>>>
>>> On Thu, May 12, 2016 at 12:01 AM, 'Mark S.' via TiddlyWiki <
>>> tiddl...@googlegroups.com> wrote:
>>>
>>>> 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
>>>>
>>>> On Wednesday, May 11, 2016 at 8:48:37 PM UTC-7, LG wrote:
>>>>>
>>>>> 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 
>>>>>
>>>>> On Monday, May 9, 2016 at 10:03:05 PM UTC-4, LG wrote:
>>>>>>
>>>>>> 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
>>>>>>
>>>>>> On Monday, May 9, 2016 at 12:10:48 AM UTC-4, Mark S. wrote:
>>>>>>>
>>>>>>> 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
>>>>>>>
>>>>>>>
>>>>>>> On Saturday, May 7, 2016 at 8:18:23 PM UTC-7, LG wrote:
>>>>>>>>
>>>>>>>> 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?
>>>>>>>>
>>>>>>> -- 
>>>> 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
>>>>  
>>>> <https://groups.google.com/d/msgid/tiddlywiki/5748c255-9a84-4e54-a95d-8736551f12d8%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>> -- 
>> 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 <javascript:>.
>> To post to this group, send email to tiddl...@googlegroups.com 
>> <javascript:>.
>> 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/8d8d1190-2366-4238-a2d5-2c5126ff0ac6%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/tiddlywiki/8d8d1190-2366-4238-a2d5-2c5126ff0ac6%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@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/54b3bffe-e090-4f92-804e-f3028ea545d9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Attachment: Project_CSV2JSON_v0-2.json
Description: application/json

Reply via email to