I moved to a new URL! Check it out!

Google Spreadsheet and nanDeck Workflow

Google Spreadsheet and nanDeck Workflow
One of the things I've been fiddling with for the past month or so is a prototype of a board game inspired by stuff like Dominion and Legendary and a mix of other stuff. It's been a collaboration with some of the local developers in the Phoenix area, and we we're getting to the point where hand writing a bunch of cards was getting really cumbersome, so I looked into tools for generating cards.


I ended up finding nanDeck, which at first looks like a pretty weird program. Okay it is a pretty weird program, but after spending some time with it it really does get the job done. There are some basic tutorials that can get you started, and some neat posts about it here as well.

nanDeck has the ability to read data from a csv file. At first I was using Open Office to manage some spreadsheets and export them to csv files for nanDeck to import, but that wasn't going to last if I wanted to collaborate with others.

I converted all of my spreadsheets into a Google Drive spreadsheet so that I could share it with others, but now the question was how can I take all of that sheet and spit out a csv for each individual spreadsheet that is a part of the document?

The first thing I needed to do was download and install the desktop version of Google Drive. This lets me access my files on Google Drive as just files on my computer, much like Dropbox.

Next I needed a csv export script. I found one here, and then modified it to fit my needs more. The script runs the onOpen method and that adds a custom menu to the document so that anyone that the document is shared with can also use the script. Adding a script to a document is located in Tools, Script Editor.


After loading the script I get a new menu option with my script function.


The script ends up spitting out a bunch of csv files into a folder on my Google Drive. These folders end up syncing to my computer, and now all I have to do is move them from there into a folder where my nanDeck project lives.



That's where a Windows batch file comes in handy. I whipped up a quick batch file that will take all of the csv files from that generated folder and copy them into my project folder. Using some custom system variables it's easy to make this work on my various work computers just by setting those variables on each of them. Just using XCOPY works great.

After the batch file runs all I have to do is click "Validate Deck" in nanDeck and it will update the data from the newly updated files, and now my new deck is ready to rock. Eventually I can even use nanDeck's command line features to copy the files and render the new deck from the batch file. Neat!

There's one major issue to look out for and that's using the Linked Data editor in nanDeck. If you click the button to edit the linked data, nanDeck seems to place the .csv file in lock down, meaning that XCOPY cant write over it. If this happens you'll have to close nanDeck to unlock the file so XCOPY can do its thing. As long as you don't use the linked data editor you'll be okay.
new comment!

Post your comment!