The shit blog of Paul Chris Jones

Exporting from Quizlet when the term contains line breaks

28th January 2014 Paul Chris Jones

I often encounter English words that I don't know the meaning to. I used to skip past them, puzzled slightly, but able to guess the meaning from the context. But at some point I got annoyed. It was like the writers were showing off. "Nyah nyah nyah! We're more articulate than you!" they were saying.

Fuck you, I thought. I have a dictionary.

So now I look up the word at dictionary.com, and then I write down the word and its definition. Here's some examples (If you want to see all 117 words, click here):

Actually, I don't "write down" the words and their definitions. Writing is barbaric. I type them.

Where do I type them? I put them into Quizlet.com. Quizlet is a virtual flashcard website. I use it often to learn French and Spanish vocabulary.

My idea was to practise these English words with flashcards, except I realised that managing the list on Quizlet isn't a good idea. Quizlet is great at flashcards, but it's difficult to manage large sets of terms. You can't separate terms that you've learned from ones you haven't, for example.

I manage my French and Spanish vocabulary lists with Excel. I like Excel as it's simple yet powerful. I can sort the words alphabetically, randomly, or by the date I entered them. I can mark words as "learned", "not learned" or "you've forgotten this word twenty times already".

Transferring sets of terms between Quizlet and Excel is easy. Quizlet has import and export functions so I can just copy and paste into and out of Excel.

The problem

I had a problem exporting my English vocabulary list today. When exporting, Quizlet separates each term with a line break, which Excel correctly interprets as a new row.

The problem was, many of my words and definitions contained line breaks too. For example, here's what a flashcard for the definition of "providence" looks like:

flashcard

And here it is being exported by Quizlet.

quizlet line break

Pasting this into excel results in an unintended new row.

excel unintended new row

I could have sorted this out manually, tidying up the few bits that were wrong. But I wondered if there was an easier way. And there is!

The solution

  1. Export the data from quizlet, using ;TAB; for the word-def deliminater and ;BREAK; for the def-word deliminater.
  2. Paste the data into Microsoft Word.
  3. Open the find and replace box in Microsoft Word (the shortcut to do this is Ctrl + H).
  4. Type ^p in the find box, and a space in the replace box. Click replace all.
  5. Now do the same again, but this time with ;TAB; in the find box and ^t in the replace box.
  6. Finally, do the same again but with ;BREAK; in the find box and ^p in the replace box.
  7. Copy and paste it all to Excel.

The Autohotkey solution

Autohotkey is automation software; it lets you automate keystrokes and mouse clicks. I wondered if could use Autohotkey as an alternative solution, just to be clever.

I needed a way to differentiate between

Quizlet lets you set your own "delimiter" to separate words and definitions. So instead of a line break, I told it to use two semi-colons (;;) because this isn't found in any of the terms.

The next step was to remove the line breaks within the words and definitions, and replace them with something more Excel-friendly. Spaces would do. To do this, I pasted the text from Quizlet to WordPad. WordPad has a handy shortcut I could take advantage of, that lets you go to the next line break by pressing Ctrl + down.

Here’s the Autohotkey code which replaced line breaks with spaces:

F2::
{
  Loop 100
  {
    SendInput ^{Down} ;go to the start of the next line break
    SendInput {Backspace} ;delete the line break
    SendInput {Space} ;add a space
    Sleep 200
  }
}
return
Here's the Autohotkey code that replaced the ;;s with line breaks:
F2::
{
  Loop 100
  {
    SendInput ^{f} ;open Find box
    Sleep 500
    SendInput {Enter} ;search for the term in the Find box (;;)
    SendInput {Escape} ;exit Find box
    SendInput {Enter} ;replace the highlighted ;; with a line break
    Sleep 200
  }
}
Finally I pasted the text into Excel, which interpreted everything correctly.

< Previous

Next >

Comments

You can use this code in a VBA Macro to do the replaces automatically in Word. Sub Quizlet_7export() ‘ ‘ Quizlet_export Macro ‘ ‘ End Sub Sub Quizlet_7export_func() With Selection.Find .ClearFormatting .Replacement.ClearFormatting .Text = "^p" .Replacement.Text = " " .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False .Execute Replace:=wdReplaceAll End With With Selection.Find .ClearFormatting .Replacement.ClearFormatting .Text = ";BREAK;" .Replacement.Text = "^p" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False .Execute Replace:=wdReplaceAll End With With Selection.Find .ClearFormatting .Replacement.ClearFormatting .Text = ";TAB;" .Replacement.Text = "^t" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False .Execute Replace:=wdReplaceAll End With End Sub

Reply

Thanks for the post. Unfortunately, when I run the second hotkey, it just enters endless line breaks in one spot. Any ideas on how to fix? Edit: I just figured it out, after opening the 'find' box, I needed to add another line to script: SendInput {;;}

Reply

Couple of things: 1) In addition to your solution, when you replace the line breaks in word, put ^p in the find box and in the replace put ~. Otherwise, follow the instructions in your document, but then as a final step in excel do a find and replace with ~ in the find box and press ctrl+j to put a linebreak in the replace box. Now, the excel doc has the line breaks in the cells too! Adjust the column widths, then highlight all of your rows and double click between any row to show all of the cells contents. 2) I vehemently oppose dictionary.com. I ardently support m-w.com.

Reply

I solved this issue with a little python code. I'm very new to coding so I'm pretty proud, haha. Hope you enjoy : https://github.com/Jewcub/PythonFlashCards

Reply

You have saved me so much time. Thank you so much for sharing this!!

Reply

Leave a comment






Paul Chris Jones is a writer and dad living in Girona, Spain. You can follow Paul on Instagram, YouTube and Twitter.