Using Excel for mass import of data into db.xml
Hello Folks,
I'm not certain if anyone would find this interesting or not, but it worked nicely for me when I had to fill in data for my GURPS TRAVELLER campaign. It would also work nicely enough for use with your needs to import mass quantities of equipment data etc.
What you need to make this work is some Excel savvy, an add-in for Excel in the form of the XML Add-in for 2003 (it works with my version of 2007 by the way), some patience as you discover how to work with the xml Add in, and a decent text editor. That's it. That's all you will need.
First, you need to know what xml structures are required for the "thing" you want to do for your massive data import. For example, lets say you have 42 firearms you wish to add to your campaign, and dread having to enter them one at a time...
Open a new spreadsheet in Exel (note: If you do not have the xml add in, this whole process is moot, you absolutely need the xml add in for it to work)
Reserve row 1 for the "element names". This is what the xml add-in will use to create for your tags. For instance, if you had a tag name of <Range> </Range> you will want to enter into the cell for line one of that column "Range".
In cell A2, enter in the value of 1.
After you hit enter, the focus in Excel drops to Cell A3 or something like that. Click again on cell A2.
Look for the Autosum symbol in the top menu area (Looks like an odd looking E). Directly under that is the word Fill in tiny letters on an icon. Click Fill.
A drop down menu appears, select "Series"
A menu box shows up with varying items. Select "Columns" for type, and enter in a stop value of 42 - then ok.
What should happen next is that it auto-numbers all cells from A2 to A43 with the value of 1+ the previous cell above it.
In Cell B2, enter the following formula:
="id-" & TEXT(A2,"00000")
Note that this will make it appear as id-00001. Coincidentally, this is the value that db.xml uses to label each "thing" in your database for that section.
Now, this is what the "template" looks like for ranged weapons:
<id-00001>
<public />
<acc type="string">4</acc>
<bulk type="string">-4</bulk>
<cost type="string">400</cost>
<damage type="string">4d+1 pi</damage>
<isidentified type="number">1</isidentified>
<lc type="string">3</lc>
<locked type="number">0</locked>
<name type="string">Carbine, 7.62 mm</name>
<nonid_name type="string">Carbine, 7.62 mm</nonid_name>
<nonid_notes type="string">Winchester M1</nonid_notes>
<notes type="formattedtext">
<p></p>
</notes>
<range type="string">330/2,100</range>
<rcl type="string">2</rcl>
<rof type="string">3</rof>
<shots type="string">15+1(3)</shots>
<st type="string">8</st>
<subtype type="string">Semi-automatic Carbine</subtype>
<tl type="string">6</tl>
<type type="string">Ranged Weapon</type>
<weight type="number">5.8</weight>
</id-00001>
Everything that has a <> and </> tag will need to have a column name in row 1 of that column, that matches precisely the name inside above. What the Excel can't do is give a data types (those "type="String" or "Type=formatted text" things). Those you will have to fix manually with a text editor.
Point is - you can enter into your excel spreadsheet, all of the data listed above - such that each row is one gun.