Request: Extending the ImportTiddlersPlugin with csv-importfunction...

9 views
Skip to first unread message

Måns

unread,
Mar 16, 2009, 3:26:47 AM3/16/09
to TiddlyWiki
Hi

Maybe this already exists - I just haven't discovered it yet - please
point in some direction - and I will look at it..

I would like to have the ability to import(autogenerate) tiddlers from
a csv-file containing information as: tiddlertitle, subtitle, tags,
fields and maybe some text...

It doesn't have to be an external text-file beeing captured/processed
by the plugin - if the csv-file had to be copy/pasted to a tiddler -
tagged as csv and thereby invoke a customized edittemplate, where you
could tweak/alter parameters as well - would be a nice touch-

but the essential ability to populate a TW with tiddlers based on a
csv - would greatly improve the workflow and interaction with other
programs.

I've seen a working csv importer in "twab" - but it is designed to
interpret contactlists from different emailclients - I on the other
hand would also like to be able to specify tags, fields and other
things in one list and populate an empty tw from it...

I've looked at the ExportTiddlersPlugin and it offers "pure store-
html" and text-tiddler source listings - I think that what I would
like is something similar in the ImportTiddlersPlugin - the ability to
import a xml, csv or spredsheet-data as predefined tiddlers would be
very usefull.

I've posted this request on the twdev pages as well - hope it's ok..

YS Måns Mårtensson

Eric Shulman

unread,
Mar 16, 2009, 12:51:51 PM3/16/09
to TiddlyWiki
> I would like to have the ability to import(autogenerate) tiddlers from
> a csv-file containing information as: tiddlertitle, subtitle, tags,
> fields and maybe some text...

http://www.TiddlyTools.com/#CreateTiddlersFromCSV

Usage: Paste CSV data into textarea. Press "create tiddlers" button

CSV format (as exported from a spreadsheet):
title,text,tags,field1,field2,field3,...
Test1,This is [[Test1]],test one foo,mumble,gronk,frotz
Test2,This is [[Test2]],test two bar,snork,snerfle,plurmb

* first lines contains lower-case 'field names' and must include a
'title' field
* 'text' field is normal tiddler body content
* 'tags' is a space-separated bracketed list (i.e., same as when
entered via tiddler editor)
* other fields (optional) are added as custom fields

enjoy,
-e
Eric Shulman
TiddlyTools / ELS Design Studios

Måns

unread,
Mar 16, 2009, 1:44:17 PM3/16/09
to TiddlyWiki
Eric - I don't know what to say....
I don't think I can come up with something in my wildest fantasy that
you haven't already made a plugin for :-)
This is really super!! I will try to make a setup to prefill my TWs
with tiddlers from a cvs-template at once..

I don't know where TW would be if there wasn't TiddlyTools... but I'm
just a newcommer and I have a lot to discover yet - I can tell form my
experiences the past month -I've tried to figure out how to accomplish
things with TW for almost a year - but since I began to ask questions
on this forum, things has really started to happen - and my TW-
adaptions are turning into very usefull applications!!!

TiddlyWiki is really worth the effort and the time it takes to learn
how to tweak it- and this group gives you the place to continue that
quest.for answers.
I like the fact that there is no RYFM-attitude and some of the really
talented programmers, sometimes answers questions from total novices
as myself - Its inspiring an very instructive indeed!!
Thanks!


YS Måns Mårtensson

Eric Shulman

unread,
Mar 16, 2009, 3:08:05 PM3/16/09
to TiddlyWiki
> CSV format (as exported from a spreadsheet):
> title,text,tags,field1,field2,field3,...
> Test1,This is [[Test1]],test one foo,mumble,gronk,frotz
> Test2,This is [[Test2]],test two bar,snork,snerfle,plurmb

Note: CSV format can include data that contains commas *within* the
values, by using double-quotes around those values, like this:
TiddlerTitle,"content, with a comma in it",tag1 tag2,...
However, the code in the 'create tiddlers' button handler currently
uses a very simple "split on comma" function that doesn't do anything
special with quoted values, so it can't cope with the above, and
simply splits it at each comma, producing incorrect results.

-e

Måns

unread,
Mar 16, 2009, 4:46:04 PM3/16/09
to TiddlyWiki
Ok...
I was hoping to be able to insert <data> in the tiddlers through the
cvs-import-function...
Then it isn't possible to insert data like this in the "textarea" for
one Tiddler??:
title,text,tags,field1,field2,field3,...
FirstStudentName,<data>
{"Name":"StudentName","Teacher":"TeacherInitials","Habitat":"SomeName","Student":true,"Class":"9"}
</data>,Student TeacherInitials
HabitatSomeName,image::http:SomeAddress,taggly.numcols::2,SomeField
SecondStudentName,<data>
{"Name":"StudentName","Teacher":"TeacherInitials","Habitat":"SomeName","Student":true,"Class":"9"}
</data>,Student TeacherInitials
HabitatSomeName,image::http:SomeAddress,taggly.numcols::2,SomeField

YS Måns Mårtensson

Måns

unread,
Mar 16, 2009, 5:19:05 PM3/16/09
to TiddlyWiki
Or can i redefine the number of textentries and imputl the "data-
string" like this?:
title,text,text,text,text,text,tags,field1,field2,field3,...
FirstStudentName,<data>
{"Name":"StudentName","Teacher":"TeacherInitials","Habitat":"SomeName","Student":true,"Class":"9"}
</data>,Student TeacherInitials
HabitatSomeName,image::http:SomeAddress,taggly.numcols::2,SomeField
SecondStudentName,<data>
{"Name":"StudentName","Teacher":"TeacherInitials","Habitat":"SomeName","Student":true,"Class":"9"}
</data>,Student TeacherInitials
HabitatSomeName,image::http:SomeAddress,taggly.numcols::2,SomeField

YS Måns Mårtensson


Måns

unread,
Mar 16, 2009, 5:21:03 PM3/16/09
to TiddlyWiki
"imputl" - should have been: input....

Eric Shulman

unread,
Mar 16, 2009, 6:34:55 PM3/16/09
to TiddlyWiki
> Or can i redefine the number of textentries and input the "data-
> string" like this?:
> title,text,text,text,text,text,tags,field1,field2,field3,...

No. That won't work. There is only one 'text' field in each
tiddler. The fieldnames on the first line must each be unique, where
'title', 'text', and 'tags' are handled specially, and all other field
names are added as custom fields.

Also, as noted in my previous follow-up message, you can't use *any*
values that contain commas within them, as this will break the simple
'split on comma' parsing that is being used.

-e


Måns

unread,
Mar 16, 2009, 7:12:48 PM3/16/09
to TiddlyWiki
Ok - I still can use it - and the simplicity of additional input into
the generated tiddlers relies heavily on how well I have designed the
custom edittemplates -
Thats perfectly ok - because its only to hold about 155 students and
21 teachers - and TWs strenght lies in beeing able to simulate a
database in the way you can use hyperlinks and fET...
I have some doublettes in tagvalues/fieldvalues and datavalues for
different uses - and I might end up with most of the information I'd
like to automate anyway...
If it was possible to make a htmlform which works on the "viewside" of
the tiddler generate fieldvalues instead of <data>textvalues - then I
could ignore text and stay with fieldvalues, of which I can have as
many as I wish?!
Can I somehow input fieldvalues with my htmltemplate (in viewmode)
instead of <data> text??

YS Måns Mårtensson

Eric Shulman

unread,
Mar 16, 2009, 7:28:27 PM3/16/09
to TiddlyWiki
> Can I somehow input fieldvalues with my htmltemplate (in viewmode)
> instead of <data> text??

http://www.TiddlyTools.com/#EditFieldPlugin

extends the TW core 'edit' macro so you can use it in the ViewTemplate
(or even just embedded in regular tiddler content. However, because
there is no 'done' button when *viewing* a tiddler, you will be
automatically prompted to accept/reject any input as soon as you move
away from that field. Otherwise, it works just like when in 'edit
mode': the value you enter is written to the tiddler as a custom field
(except for fields named 'title', 'text', and 'tags', of course).

-e

Måns

unread,
Mar 16, 2009, 8:44:58 PM3/16/09
to TiddlyWiki
Thanks Eric
Three last questions:
Uptill now I've been using:
FieldsEditorPlugin

Name: FieldsEditorPlugin
Description: create, edit, view and delete commands in toolbar fields.
Version: 1.0.2
Date: Dec 21,2007
Source: http://visualtw.ouvaton.org/VisualTW.html
Author: Pascal Collin
License: BSD open source license
CoreVersion: 2.2.0
Browser: Firefox 2.0; InternetExplorer 6.0, others

Must I delete this before I install EditFieldPlugin because of
possible conflicts?

Can I make my Html "write value to fields" with existing Html "knobs"
or can I just rewrite my template with the new "EditFieldKnobs"
Can I fx. setup lists in a table to choose from - in my
"taginvoked"ViewTemplate? like I do in my "taginvoked"EditTemplate:
<td style='width:20%'><div class='small'>teacher:</div><div
class='editor' macro='select teacher rows:1 width:100% allowBlank
allowOther +teacherList allowEdit'></div></td></table>...
or: <td style='width:20%'>
<div class='small'>day of the week :</div>
<div class='editor' macro='select dayoftheweek rows:1 width:100%
allowBlank allowOther mon tue wed thu fri sat sun'></div>
</td></tr></table>

If this is possible - there isn't really any use for the Html-form at
all..

YS Måns Mårtensson

Måns

unread,
Mar 16, 2009, 8:45:10 PM3/16/09
to TiddlyWiki

Eric Shulman

unread,
Mar 16, 2009, 9:19:23 PM3/16/09
to TiddlyWiki
> Uptill now I've been using:
> FieldsEditorPlugin
> Must I delete this before I install EditFieldPlugin because of
> possible conflicts?

FieldsEditorPlugin is a very useful general-purpose 'field maintenance
tool'. EditFieldPlugin is an enhancement to the TW core's existing
'edit' macro so that it can be used in a ViewTemplate or embedded
directly in tiddler content (via <<edit fieldname>>). Although both
plugins can write into tiddler fields, they don't do it at the same
time, and there is no known conflict between them.

> Can I make my Html "write value to fields" with existing Html "knobs"
> or can I just rewrite my template with the new "EditFieldKnobs"
> Can I fx. setup lists in a table to choose from - in my
> "taginvoked"ViewTemplate? like I do in my "taginvoked"EditTemplate:
> If this is possible - there isn't really any use for the Html-form at
> all..


http://www.TiddlyTools.com/#InputPackage

includes several plugins that let you write custom tiddler field
values using form controls (text/multi-line input, checkboxes,
listboxes, droplists) in *either* template.

Note: I have not (yet) written a [[RadioButtonPlugin]] . However, you
can always use ListboxPlugin to provide a simple 'select' droplist
that gathers the same kind of "choose one among several" input, so
implementing radio buttons may not actually be necessary.

enjoy,
-e

Ken Girard

unread,
Mar 16, 2009, 11:43:21 PM3/16/09
to TiddlyWiki
Thank you very much, Eric. I was looking for something like this.
I think I have a date with a spreadsheet tomorrow. 800+ rows, 35
columns each, customized templates to show it all, along with a
healthy mixture of ForEach for data mining, and 97% of it is already
up and running.

Ken Girard

Måns

unread,
Mar 17, 2009, 4:46:57 AM3/17/09
to TiddlyWiki
Thanks Eric

I will rewrite my templates and use EditFieldPlugin instead of the
Htmlform I've used so far - because of the ability to setup a csv with
all the thinkable data to prepopulate tiddlers.

YS Måns Mårtensson

Måns

unread,
Mar 23, 2009, 4:04:34 AM3/23/09
to TiddlyWiki
Hi
I've rewritten my templates, forms and fETs - but I can't make the
csvImport work correctly.
(I'm using it in a wrong way I'm sure..)
When I input this:
title,text,tags,felt1,felt2,felt3
Test1,Dette er Test1,test et foo,mumle,grynt,fnys
Test2,Dette er Test2,test to bar,snork,snøvle,pludder

I get this:

Made _t_
Made _y_s_ _T_e_s_t_2_
Made _o_r_k_
Made _ø_v_l_e_
Made 4 tiddlers

It should only produce 2 tiddlers (Test1 and Test2).
Tiddler nr 1 produced, has a wrong title and "f" in the text body - no
tags or fields at all.
Tiddler nr 2 produced, has the right tags (according to Test2
inputline) (all three of them) the right text but only the first
fieldtitle with a value of: "s" and a wrong title.
Tiddler nr 3 produced, has a wrong title, no tags and no fields and
"s" in the textbody
Tiddler nr 4 produced, has a wrong title, no tags and no fields and
"pludder" in the textbody.

What am I doing wrong??

YS Måns Mårtensson

Måns

unread,
Mar 23, 2009, 4:42:19 AM3/23/09
to TiddlyWiki
I've tried to insert qoutes as textseperation but I get (almost) same
result:
Made _t_"_
Made _y_s_"_ _"_T_e_s_t_2_"_
Made _o_r_k_"_
Made _ø_v_l_e_"_
Made 4 tiddlers
from:

titel,tekst,tags,felt1,felt2,felt3
"Test1","Dette er Test1","test et foo","mumle","grynt","fnys"
"Test2","Dette er Test2","test to bar","snork","snøvle","pludder"

YS Måns Mårtensson

On 17 Mar., 09:46, Måns <humam...@gmail.com> wrote:
Reply all
Reply to author
Forward
0 new messages