Excel to Twine? Is it possible to create passages automatically from an exported HTML table

Twine Version: Twine 2.11.1
Using: Harlowe

Hi! First post! :smiley:

Long time lurker

Have a technical question, hope there’s some solution.

Is it possible to transform an Excel spreadsheet into a Twine story?

I have a list of content which I’d like to display.

Example of the source (attached screenshot):

Passage Author Homepage Poem Passage Content
[[Passage A]] Ant websiteURL1 Lorem Lorem websiteURL1 Ant
[[Passage B]] Bug websiteURL2 Ipsum Ipsum websiteURL2 Bug
[[Passage C]] Chair websiteURL3 Dolor Dolor websiteURL3 Chair
[[Passage D]] Dice websiteURL4 Sit Sit websiteURL4 Dice
[[Passage E]] Elephant websiteURL5 Amet Amet websiteURL5 Elephant

In the spreadsheet I have five columns: Name of the passage, author, the author’s homepage, and the passage content.

In the passage content, I’d like to display some additional content, which is the fifth column, it includes information from the other columns.

The desired outpout is shown below (sorry can’t post images yet):

                            β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                                             
                            β”‚           HOME           β”‚                                             
                            β”‚      [[Passage A]]       β”‚                                             
                            β”‚      [[Passage B]]       β”‚                                             
                            β”‚      [[Passage C]]       β”‚                                             
                            β”‚      [[Passage D]]       β”‚                                             
                            β”‚      [[Passage E]]       β”‚                                             
                            β”‚                          β”‚                                             
              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”¬β”€β”€β”¬β”˜                                             
              β”‚                        β”‚     β”‚     β”‚  β”‚                                              
              β”‚                        β”‚     β”‚     β”‚  └───────────────────────┐           
              β”‚                        β”‚     β”‚     β”‚                          β”‚           
              β”‚             β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β”‚     └─────────┐                β”‚           
              β”‚             β”‚                β”‚               β”‚                β”‚           
              β”‚             β”‚                β”‚               β”‚                β”‚           
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”
β”‚Passage A       β”‚ β”‚Passage B     β”‚ β”‚Passage C    β”‚ β”‚Passage D    β”‚  β”‚  Passage E   β”‚
β”‚Lorem           β”‚ β”‚Ipsum         β”‚ β”‚Dolor        β”‚ β”‚Sit          β”‚  β”‚  Amet        β”‚
β”‚websiteURL1     β”‚ β”‚websiteURL2   β”‚ β”‚websiteURL3  β”‚ β”‚websiteURL4  β”‚  β”‚  websiteURL5 β”‚
β”‚Ant             β”‚ β”‚Bug           β”‚ β”‚Chair        β”‚ β”‚Dice         β”‚  β”‚  Elephant    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Read about Tweego and Extwee and Lambdas and Macros and saw Youtube videos… and honestly have no idea where to start.

What has worked:
What works is exporting the Excel table as an HTML table, pasting it in Twine, and it automatically creates the passages. But I’m stumped on how to insert the content automatically in the passages, it is eluding me.

Thanks!

Twine will create passages whenever it sees [[]] but that’s just a side-effect, not really what you want.

What you ideally want to do is turn your existing spreadsheet into twee, which is a text-only format that Twine can import from (and export to). Twee is a very simple format, one of your passages would just look like:

:: Passage A
Lorem
websiteURL1
Ant

Turning your CSV into that is pretty simple if you know some text processing languages. The classic one would be Perl, but you could do this with PHP, or with Javascript, or with Python, or with Ruby, etc. etc. Of course, that assumes you have familiarity with such languages. You could even do it in Excel with Visual Basic … good luck there.

You could also (I’m gritting my teeth here, but it’s something they are good at) give the CSV to an AI and ask it for the appropriate output, but you will need some tweaking, and it’s not a good approach if you will be doing the same conversion often.

If you need to do this often, and don’t have any of the programming skills to write your own command-line conversion program, you could maybe get a kind user here (or an AI) to write a reusable converter for you?

2 Likes

Thanks, hadn’t thought of asking AIs!
will try that

If you need to do this often

Have Keyboard Maestro installed so will check how to create a converter there