A way to import lists to make tiddlers from list items

111 views
Skip to first unread message

barro...@gmail.com

unread,
Jul 9, 2018, 5:21:24 AM7/9/18
to TiddlyWiki
One way to make an import file of a list converted into individual tiddlers with Google Sheets. 

For simplicity, this just involves designating tiddler titles and under one line/paragraph of tiddler content (whatever can be contained in one cell, more on tiddler content below). This can be expanded upon with only a little more effort.  In fact, this can be expanded upon greatly with sheets, forms and text editor macros/scripts.

Using a blank sheet, break up the standard div container for an individual tiddler from a html import fotmat for tid's. (from here - https://groups.google.com/forum/#!searchin/tiddlywiki/import$20multiple$20tiddlers%7Csort:date/tiddlywiki/PQ-GWjqAVOk/VEp78ef0FAAJ)

<div created="" modified="" tags="Africa" title="" type="text/vnd.tiddlywiki" namesec=""> _tidler content_ </div>

This is an example list of African nations so it already has "Africa" as a tag for use in in a table of contents, can be changed to whatever tag you want for, for appearing in a table of contents.  In that case you may want to add a root tiddler with the title but not tag for the root page of the list (in this case "Africa") and all other tiddlers will bear that title as a tag.  Or create the root page and ToC ahead of time in your TW.

namesec="" is a blank field that I want added to all the tiddlers, that can be omitted or changed to fields you may want.

Break up the tid div line above into separate cells like so, make sure there's no leading or trailing spaces.

cell A2 - <div created="" modified="" tags="Africa" title="
cell B2 - leave blank for now
cell C2 - " type="text/vnd.tiddlywiki" namesec="">
cell D2 - leave blank for now
cell E2 - </div>
cell F2 - =concatenate(A2,B2,C2,D2,E2)

cell F2 gets a formula that will join cells A2, B2, C2, D2, E2 into one line of text

Now, through copying and repeated pasting or using a duplicate row script, make as many duplicate rows of the row you created.

Once that is done, you can take the list you want to use with just line breaks to have the list in a column but make sure there's no leading or trailing spaces.  Example list, this is just a short portion for example:

Africa
Botswana
Gaborone
Burkina Faso
Ouagadougou
Burundi
Bujumbura
Cameroon
Yaoundé
Aminah Natchma

That will paste nicely into cell B2 which you left blamk and each line of the list will go into a separate cell below (B3,B4,B5,B6,B7, etc).  You just filled in the tddler titles all at once.

The other cell/column you left blank, D2, corresponds to the tiddler text body, which can be left blank or if you have content already can be inserted in like the titles list, which here I again pasted the titles list as an example.  With this simple setup, the content must be contained in one list line however long doesn't matter just as long as one tiddler content "body" per line/cell.  Paragraphs could be separated inside a cell with CNTRL ENTER but I hadn't tested that yet.

You could manually edit in anything you're familiar with such as any of the various fields like tags.  A more detailed breakup with the sheet could also provide blank columns (like for B2 & D2 above) for any fields you want.

Once the titles list and any content or manual editing is added, everything will be automatically put together as you work by the formula in column F.  Attached screenshot shows the Google sheet used for this.  So all you have to do is copy all of column F (click column header and CNTRL C) and paste into a text editor and this is the result:

The first line would be the slightly edited root page that has the "Africa" tag replaced with a tag for what ever table of contents you want the list to go to.

<div created="" modified="" tags="Contents" title="Africa" type="text/vnd.tiddlywiki" namesec="">Africa</div>
<div created="" modified="" tags="Africa" title="Botswana" type="text/vnd.tiddlywiki" namesec="">Botswana</div>
<div created="" modified="" tags="Africa" title="Gaborone" type="text/vnd.tiddlywiki" namesec="">Gaborone</div>
<div created="" modified="" tags="Africa" title="Burkina Faso" type="text/vnd.tiddlywiki" namesec="">Burkina Faso</div>
<div created="" modified="" tags="Africa" title="Ouagadougou" type="text/vnd.tiddlywiki" namesec="">Ouagadougou</div>
<div created="" modified="" tags="Africa" title="Burundi" type="text/vnd.tiddlywiki" namesec="">Burundi</div>
<div created="" modified="" tags="Asia" title="Bujumbura" type="text/vnd.tiddlywiki" namesec="">Bujumbura</div>
<div created="" modified="" tags="Africa" title="Cameroon" type="text/vnd.tiddlywiki" namesec="">Cameroon</div>
<div created="" modified="" tags="Africa" title="Yaoundé" type="text/vnd.tiddlywiki" namesec="">Yaoundé</div>
<div created="" modified="" tags="Africa" title="Aminah Natchma" type="text/vnd.tiddlywiki" namesec="">Aminah Natchma</div>


Add this above the results:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">

<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
<title>import contacts</title>
<style type="text/css">
</style>
</head>
<body>
<div id="storeArea">


Add this below your results:

</div>
</body>
</html>


Save as a html file and you have a file you can import into your TW and it will create individual tiddlers of your list

Clipboard01.jpg

Mark S.

unread,
Jul 9, 2018, 10:42:26 AM7/9/18
to TiddlyWiki
That's a nice general approach when your data has special requirements. There's also the XLSX edition (https://tiddlywiki.com/editions/xlsx-utils/) when you have lots of regularly formatted data to import.

barro...@gmail.com

unread,
Jul 10, 2018, 8:40:37 AM7/10/18
to TiddlyWiki
Hello Mark

Most excellent, thank you for pointing me to it.  Google Sheets can export as Excel format, would your plugin work with Excel format generated by Sheets?

That's a nice general approach when your data has special requirements. There's also the XLSX edition (https://tiddlywiki.com/editions/xlsx-utils/) when you have lots of regularly formatted data to import.

My hope with the workflow I posted would help users new to TW with a technique they could use before learning other more advanced methods there may be.  That method allowed me to create a world continents/nations/capitals listing/ToC of about 425 entries/tiddlers (with reference links to Wikipedia entries) from Wikipedia's list of nations and their capitals by continent.  I kept the import html files and will be providing them to community.
Reply all
Reply to author
Forward
0 new messages