Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account
This post has been closed. You can still view previous posts, but you can't post any new replies.

Import abilities and attributes from csv

April 05 (11 years ago)

Edited April 05 (11 years ago)
I've recently started getting fancy and using the many useful things that roll20 offers in terms of streamlining gameplay. In order to make full use of this, however, I need to set up a large number of attributes and abilities for all characters. What would make this process a lot easier (and might become even more relevant with the upcoming character sheet update) is a possibility to enter these values in an external/offline data file (for example a simple csv) and import it directly.

Currently, the format for that could be quite simple:
type;name;value;max (for attributes);
e.g.
attr;attribute_name;2;4;
abil;ability_name;2d6<4;;
etc.

For the character sheet update, additional columns and types could be added.
April 05 (11 years ago)
This is possible with the API script.
Thanks for the response - now I'm curious though: I understand that I could run createObj("attribute",...) for all relevant attribute and abilities accordingly - that part is easy. How would one go about working with and parsing an external file though?
April 06 (11 years ago)
GiGs
Pro
Sheet Author
API Scripter
I wish this was possible for everyone, not just those with access to the API script.
April 06 (11 years ago)
I wrote Monster and Character Importer scripts for D&D 4e using the raw xml data you can export from the DDI Adventure Tool and Character Builder. That is a pain in the ass. A CSV format would be so easy.
April 07 (11 years ago)

Edited April 07 (11 years ago)
Lithl
Pro
Sheet Author
API Scripter

The simplicity of parsing a CSV file is deceptive. At least XML is well-defined. CSV, on the other hand... is it a "comma separated value" file, or a "character separated value" file? Comma may be the gold standard, but I've seen pipes used as well, and the OP's examples use semicolons. What do you do if a cell contains your separating character? It's normal to enclose the cell in double quotes, but I've seen other escaping methods (such as a backslash before the offending character), and what if the cell also contains a double quote? Two? What about newlines? Usually, a newline indicates a new record in a CSV, but I've seen CSV formats where newlines are permitted if they're escaped... which goes back to the escaping problem from before. Does "escaped" mean we enclose the record in quotes (that could result in a a cell containing a quote throwing off the record boundaries), or something else? If we escape with a backslash, does that mean a newline-within-a-cell ends one line with a backslash, or do we use \n? Or maybe \\n? What about other languages? Japanese uses 『double hook brackets,』 for example.

Worse, nearly every program capable of reading CSV files has different rules for parsing them. It isn't a well-defined file format.

Finally, as someone who has relatively recently been forced to work with similar files as part of my job, I object strongly to any file which represents tabular data in a format such as record type,record data -- a file containing tabular data should contain one type of record. Tabular files containing disparate record types are almost as bad as vertical tables in a relational database.

DId someone already write an API script for loading\saving character sheets via XML? That sounds awesome. Where's that at?

April 08 (11 years ago)
Lithl
Pro
Sheet Author
API Scripter
HoneyBader's been working on D&D 4e import stuff (characters and monsters, IIRC), and somebody else has an importer for Pathfinder. You can find them in the API forum.
April 08 (11 years ago)
Yup. Click my name and view my profile. Then click view topics.
April 08 (11 years ago)
So for anyone else who has been following this with interest, the answer to "How would one go about working with and parsing an external file?" is that you copy & paste it into the GMNotes field and then parse it from there.

Quite clever, really.
April 08 (11 years ago)
It's currently the only way to get external data into Roll20.