Convert rows of Excel into individual Markdown files

Hi, I’m looking to take a spreadsheet (CSV) of 100 rows - two columns, the first column is a “full name,” the second column is an “email address,” - and convert the spreadsheet to 100 markdown files, with the file name “full name,” and the body “email address.” Would appreciate any pointers, thanks!

“Split Text” will let you split the CSV in lines (rows) and each line in fields (cells). “Get item from list” will let you pick a column (cell) of each row. With “Set name” you can change the name of the file before saving it. And put those files in a list, and you can save them all at once.

If you are in Excel, you could add a formula like this in a third column.

=CONCAT("echo """, B1, """ > """, A1, ".md""")

Then fill down for your rows to generate some output in this sort of form.

image

That effectively creates a bunch of simple terminal/shell commands to create the files.

echo "j.smith@mail.com" > "John Smth.md"
echo "Joe@blogg.com" > "Joe Bloggs.md"
echo "Jane.doe@com.com" > "Jane Doe.md"

echo is taking the e-mail address, and the > is directing it into Markdown file of the specified person’s name.

You can put the commands in ascript in the folder where you want to create the Markdown files, and run it so you don’t have to run them one at a time in the Terminal app.

e.g. make a text file called “mdfiles” in the folder where you want the files and add the ‘bash’ line (a wayt to say what type of script it is) followed by the generated lines from Excel.

#!/bin/bash
echo "j.smith@mail.com" > "John Smth.md"
echo "Joe@blogg.com" > "Joe Bloggs.md"
echo "Jane.doe@com.com" > "Jane Doe.md"

Then from the Terminal app, use the cd command to change to the corect folder if necessary, and use the command sh mdfiles in the folder to build them in that folder.

If you already have the CSV and this was something you were doing regularly, I’d be tempted to write a small shell script using AWK to take the CSV and process it directly. But I get the feeling this is a one off and given you’re working with a CSV in Excel, that you are more comfortable there.

1 Like

Thank you very much for this detailed solution. I will take this solution and work on it.

Thank you very much.

Thank you very much, I am good to go!