PDA

View Full Version : CSV Table Importer MK



mattekure
July 9th, 2019, 14:23
Now Available on the Fantasy Grounds Forge: https://forge.fantasygrounds.com/shop/items/34/view

This extension allows you to import the contents of a Comma Separated Values(CSV) file into a Formatted text control. Importing the CSV into a formatted text control will create it as a formatted table.
Note: This extension is based on the CSV Table Paster extension by lokiare which is available here: https://www.fantasygrounds.com/forums/showthread.php?40821-CSV-Table-Paster-Community-Extension-Early-Access-release Much thanks to him.

Usage:
Usage: Open the window where the text will be imported. In the formatted text field, add a line with "#table#" as the only text on the line. Click the Import CSV button below and select your CSV file.
-yqt5tzuPaM


If the table is not importing, try closing the record and reopening it, then Importing the CSV again.

https://i.imgur.com/mXpowYq.jpg

https://i.imgur.com/qXNJPya.jpg

https://i.imgur.com/SvYE6YQ.jpg

Supported Rulesets: CoreRPG, 5E, 2E, PFRPG, PFRPG2, Savage worlds

lokiare
July 9th, 2019, 20:30
This extension uses code from my extension with permission from me to use it.

Bidmaron
July 10th, 2019, 04:30
Here's how you can do it:

In your onInit routine, place the following code:

OptionsManager.registerOption2("GENPUNC", false, "option_header_game", "option_label_GENPUNC", "option_entry_stringer",
{ baselabel = "option_val_comma", baseval = ",", default = "," });

'GENPUNC' or whatever you want to use instead of that will be the reference you later use to get the value of the setting.
The false parameter tells the option manager it is an option that should be stored in the campaign database (true causes it to be stored in the campaign registry).
'option_header_game' tells the Options Manager to put the setting into the games settings area (see the strings\strings_utility.xml file for the constants you can use to control where the option appears)
'option_label_GENPUNC' tells the Options Manager to look for this string resource for the label you want assigned on the options manager. It looks like this:


<string name="option_label_GENPUNC">Generators: Punctuation to separate items in a series</string>

'option_entry_stringer' is the windowless you want to use to handle the interaction with the user. There is not currently a built-in routine to handle what you are looking for, but this code below is fully tested and will handle a string option setting that is free-form:


<windowclass name="option_entry_stringer">
<margins control="0,0,0,2" />
<script>
local sOptionKey = nil;
local sDefaultVal = "";
local enable_update = true;

function setLabel(sLabel)
label.setValue(sLabel);
end

function setReadOnly(bValue)
stringer.setReadOnly(bValue);
end

function initialize(sKey, aCustom)
sOptionKey = sKey;

if sOptionKey then
if aCustom then
sDefaultVal = aCustom.baseval or "";
end

enable_update = false;
local sValue = OptionsManager.getOption(sOptionKey);
stringer.setValue(sValue);
enable_update = true;
end
end

function onHover(bOnWindow)
if bOnWindow then
setFrame("rowshade");
else
setFrame(nil);
end
end

function onValueChanged()
if enable_update and sOptionKey then
local sValue = stringer.getValue();
OptionsManager.setOption(sOptionKey, sValue);
end
end
</script>


The last parameter is an array passed to control behavior. Since this is a freeform string, I don't set up a series of labels, but you could conceivably setup a series of "|" (pipe) delimited string resource names of labels to use. (or lablesraw if you don't want resources).
What I have up there will make the default be a comma, and the 'option_val_comma' is a string resource you set up in your xml file like this:


<string name="option_val_comma">,</string>


Where you need to get the current CSV setting, you would do something like this:


local sSeparator=OptionsManager.getOption("GENPUNC");

If you needed to (not sure why you would need to), you could use the Options Manager to register a callback to your code if the value of your setting changes. (see the Options Manager registerCallback and unregisterCallback routines).

mattekure
July 10th, 2019, 11:54
That was amazing Bidmaron, thanks. Excellent documentation

Bidmaron
July 10th, 2019, 11:56
You are very welcome sir

Andraax
August 4th, 2019, 20:42
Bug: If there is whitespace between the comma and a following " then it ignores the quotes.

mattekure
August 4th, 2019, 21:48
Bug: If there is whitespace between the comma and a following " then it ignores the quotes.

This isnt actually a bug as this is not following the CSV standard. https://tools.ietf.org/html/rfc4180

CSV fields are separated by a comma and either begin with a double quote, or not. If a CSV field does not begin with a double quote, it cannot contain quote characters within it. In your example, the field is beginning with a space, and so the entire field should not contain any quote characters. If a CSV field does begin with a double quote, it can contain a quote symbol by escaping it with another double quote. For example. value1,"value2""stillvalue2",value3 where the middle term evaluates to value2"stillvalue2

Andraax
August 5th, 2019, 00:15
You seem to have skipped the part that says:


While there are various specifications and implementations for the CSV format (for ex. [4], [5], [6] and [7]), there is no formal specification in existence, which allows for a wide variety of interpretations of CSV files. This section documents the format that seems to be followed by most implementations:

So, while this documents the most common format, it is not a formal specification.

LordEntrails
August 5th, 2019, 00:41
So, while this documents the most common format, it is not a formal specification.
Well, I guess one way to think of it is if the author of an extension wants it to work one way and its working that way, then it's working correctly.

Of course someone can always ask for an extension to be coded differently, but that's different than saying it not working correctly.

mattekure
August 5th, 2019, 01:00
You seem to have skipped the part that says:



So, while this documents the most common format, it is not a formal specification.

I did not in fact skip that part. Yes, it is not a formal specification but attempting to account for every possible implementation and undocumented version of the file format is not really productive. So I wrote to the most common format.

mattekure
August 5th, 2019, 03:42
Version 1.2 uploaded. Added the ability to skip leading and trailing spaces.

Andraax
August 5th, 2019, 12:09
Version 1.2 uploaded. Added the ability to skip leading and trailing spaces.

Thank you.

mattekure
August 5th, 2019, 14:27
Update to version 1.3. Thanks to the code provided by Bidmaron I have added the ability to select other delimiters. The default is a comma, but in the options you can now select between a comma ",",pipe "|", semi-colon ";", and colon ":".

Bidmaron
August 5th, 2019, 23:07
Glad to help, mattekure! And I think it's remarkable you did this mod.

mattekure
August 6th, 2019, 00:03
Glad to help, mattekure! And I think it's remarkable you did this mod.

Thank you. To give credit where it is really due, the bulk of the extension was already built when I decided to tweak it. I've tried to add a little bit to it and fix up a few things, but I do greatly appreciate the original work done by Lokiare.

deer_buster
September 14th, 2019, 04:39
Small bug, strings.xml needs to have a "root" node, not a "base" node.

lokiare
September 15th, 2019, 15:29
Small bug, strings.xml needs to have a "root" node, not a "base" node.

Fantasy Grounds Classic can use either, but Fantasy Grounds Unity is stricter on XML interpretation and must have a 'root' node instead of a 'base' node.

mattekure
September 15th, 2019, 15:51
v1.3a uploaded. changes the xml to a root node for compatibility with Unity.

Thanks for the report!

brunocalado
November 28th, 2019, 17:08
Can you change your loadorder do <55?

Can't replace your button in my theme.

mattekure
November 28th, 2019, 17:27
I'll have to test it, but I can certainly try. Here is a version with the load order set to 54.

brunocalado
November 28th, 2019, 17:28
I'll have to test it, but I can certainly try. Here is a version with the load order set to 54.

Thank you. You're awesome.

mattekure
November 28th, 2019, 17:34
let me know the results, if it works fine, I'll go ahead and post the update on my extensions thread.

brunocalado
November 28th, 2019, 17:40
let me know the results, if it works fine, I'll go ahead and post the update on my extensions thread.

30536

Asterionaisien
February 23rd, 2020, 15:44
I would like to thank you and Lokiare for this great extension, it has really helped me a lot in converting a ruleset for my use. Works really fine, great work!

moongleam
April 3rd, 2020, 00:23
Hi guys.
I am total noob here and I have need for this tool.
But here what happens when I start this wonderful extension. No sure but I think it's not working becouse of it.

[4/3/2020 1:16:36 AM] [WARNING] window: Anchored static height ignored for control (csvtp_label) in windowclass (CSVTPWindow)
[4/3/2020 1:16:36 AM] [WARNING] window: Anchored static height ignored for control (csvtp_label) in windowclass (CSVTPWindow)

Ah yes. I have FGU.

Thanks to any good soul that can help me here.

mattekure
April 3rd, 2020, 00:57
Hi guys.
I am total noob here and I have need for this tool.
But here what happens when I start this wonderful extension. No sure but I think it's not working becouse of it.

[4/3/2020 1:16:36 AM] [WARNING] window: Anchored static height ignored for control (csvtp_label) in windowclass (CSVTPWindow)
[4/3/2020 1:16:36 AM] [WARNING] window: Anchored static height ignored for control (csvtp_label) in windowclass (CSVTPWindow)

Ah yes. I have FGU.

Thanks to any good soul that can help me here.

Thanks for the report, I will try to put out an update that fixes those. Meanwhile, those are just minor warning messages that dont affect the functioning of the CSV import. You can safely ignore them until I put out the update.

mattekure
April 3rd, 2020, 02:03
v1.4 posted. Fixed the console errors for both classic and unity.

moongleam
April 3rd, 2020, 14:48
Wonderful job. Everything works perfect.
I have also tried to copy table where I shouldn't but it's my mistake.

Thank you so much mattekure for making our lives easier, you really made my day better and my work with FG more comfortable.

Durak Zaesul
April 4th, 2020, 22:52
Hey mattekure,

Thanks for creating this tool, it has been very useful. Unfortunately, I am still receiving errors even with v1.4.

33073

Using in a 5e campaign on FGC.

mattekure
April 5th, 2020, 05:10
Hey mattekure,

Thanks for creating this tool, it has been very useful. Unfortunately, I am still receiving errors even with v1.4.

33073

Using in a 5e campaign on FGC.

Could you try again with all other extensions removed. I am not seeing this with a new 5e campaign.

Durak Zaesul
April 5th, 2020, 17:14
I removed all other extensions as you suggested. I also attempted in a newly created campaign, and deleted and re-downloaded the v1.4 file and replaced. If no other users are experiencing issues, I will assume this is something on my end only. I hope the provided images help.

I found that the same console errors shown in my previous post still occur every time the "CSV" button is clicked. Is that button still supposed to show as the blue hammer icon as it was in previous versions? With additional testing, I found the following:

1. Unable to import tables to a "Skills", "Feats", "Features", or "Traits" link sheet in a character sheet. I was able to do this in previous versions without issue.
2. Tables do successfully import to link sheets for "Items" and "Story".

33140
33141
33142
33143
33144

mattekure
April 5th, 2020, 17:18
Hmm, ok. I'll take a closer look and see if I cant recreate this and fix it.

thanks

mattekure
April 6th, 2020, 01:11
I removed all other extensions as you suggested. I also attempted in a newly created campaign, and deleted and re-downloaded the v1.4 file and replaced. If no other users are experiencing issues, I will assume this is something on my end only. I hope the provided images help.

I found that the same console errors shown in my previous post still occur every time the "CSV" button is clicked. Is that button still supposed to show as the blue hammer icon as it was in previous versions? With additional testing, I found the following:

1. Unable to import tables to a "Skills", "Feats", "Features", or "Traits" link sheet in a character sheet. I was able to do this in previous versions without issue.
2. Tables do successfully import to link sheets for "Items" and "Story".

33140
33141
33142
33143
33144

Ok, update 1.5 is uploaded.

For the console errors, I can only plead temporary stupidity. The 1.4 I uploaded had zipped up the wrong set of files. it zipped up a different test set. This should have no console errors *hopefully*

I did find why the entries from a char sheet were not working and added them.

Durak Zaesul
April 6th, 2020, 02:00
Thanks mattekure, v1.5 seems to have everything working as intended! Awesome work, thanks for the rapid fix!

orien45
April 28th, 2020, 21:23
Quick note, the Demo video on the OP seems to be no longer there. Just letting you know for clean up or correction purposes.

mattekure
April 28th, 2020, 22:55
Quick note, the Demo video on the OP seems to be no longer there. Just letting you know for clean up or correction purposes.

I dont know how that happened, somehow Youtube deleted it. I have re-uplaoded the video and it should be available now. I have changed the link on the first post.

orien45
April 29th, 2020, 12:15
Thank you for all the great stuff, btw!

MadNomadGM
May 9th, 2020, 18:15
Great work by you and the legacy mod creator! I'm building some complex table systems and this will help a lot.


One suggestion for the future, if you are still working on this at all. It would be really cool if entries in the tables could reference other files instead of just text.

For example, when creating a table directly in FG you can drag an npc or an item or any object into the row and when that roll is done it will paste the link to that nps, or object, etc in the chat, story, encounter, etc.

I imagine that each of those items, when dragged into the table, are essentially links. And Maybe if you knew the name and formatting of those links it would be possible to enter those in the .csv file and covert them to links on import?

Just an idea.

mattekure
May 24th, 2020, 01:10
v1.6 uploaded. added support for BetterMenu extension

roninkelt
November 4th, 2020, 22:23
I'm having trouble getting the extension to work consistently. For the last week or so, I've had to restart FGC to get tables to show up.

Tried doing a bit of debugging by turning off all other extensions with no change in behavior. Not seeing any output to the console so is difficult to go any farther. Any suggestions?

mattekure
November 4th, 2020, 23:56
I'm having trouble getting the extension to work consistently. For the last week or so, I've had to restart FGC to get tables to show up.

Tried doing a bit of debugging by turning off all other extensions with no change in behavior. Not seeing any output to the console so is difficult to go any farther. Any suggestions?

The key to getting the tables to import consistently is to ensure that the window being imported into is the most recently opened window.

In general, the process is

Open the CSV Importer window
Open the window where you want to input text and put in the #table#
Go to your CSV file, copy all of the contents
Return to FG
Close and then Reopen the window where you want to import the data
click the import button on the CSV importer window.


I know it seems a bit weird, but it is important to close and reopen the target window just before clicking the import button on the CSV importer window. This is the only way that the extension knows which window to target for the import.

roninkelt
November 5th, 2020, 00:22
ah, important steps I didn't know about. Will follow your procedure and let you know how it goes. Thank you.

Coveny
November 10th, 2020, 17:24
Is it possible to import multiple tables for random encounters that references creatures from the SRD?

So like parent table
1 = 1d2 Orcs (child table)
2 = 1d3 Goblins (child table)
3 = 1d4 Kobolds (child table)

Even if I can't do the parent table being able to do multiple tables from a csv file would be lovely.

mattekure
November 10th, 2020, 17:43
Is it possible to import multiple tables for random encounters that references creatures from the SRD?

So like parent table
1 = 1d2 Orcs (child table)
2 = 1d3 Goblins (child table)
3 = 1d4 Kobolds (child table)

Even if I can't do the parent table being able to do multiple tables from a csv file would be lovely.

No importing multiple tables from a single CSV file is not possible. there is no provision in the CSV file format standard that would allow the definition of multiple tables that way.

roninkelt
November 12th, 2020, 00:52
I think you'd have to create the child tables first, then the parent table and drop the children into the parent to get proper linking.

roninkelt
November 17th, 2020, 20:19
Now having trouble importing rollable tables. Same difficulty as before, except I'm following the steps above as applicable. Is there some trick to doing this?

Getting the following messages in the console:

Runtime Notice: s'Opening window table with path tables.id-00001'
Runtime Notice: s'Opening window masterindex with path tables'
Runtime Notice: s'Window has closed'
Runtime Notice: s'Window has opened'
Runtime Notice: s'Couldn't get the node for the window.'
Runtime Notice: s'Window has closed'
Runtime Notice: s'Window has opened'
Runtime Notice: s'NodePath:tables.id-00001'
Runtime Notice: s'Class:table'
Script Error: [string "scripts/CSVTablePaster.lua"]:295: attempt to perform arithmetic on local 'startp' (a nil value)

mattekure
November 17th, 2020, 21:55
I'm not seeing this. My general process is to:


Open the CSV Importer Window
Open the Table records window.
Copy the CSV data
In the Table Records window, click on the green + to create a new rollable table
click the Convert Clipboard button.


That correctly creates a table with my test CSV files. If you are still having trouble, could you try posting a copy of a CSV file and I'll take a look at it.

roninkelt
November 18th, 2020, 01:58
No dice, I'm completely unable to paste a rollable table. I've turned off all other extensions, but that hasn't made any difference.

error messages in the console

Runtime Notice: s'Window has closed'
Runtime Notice: s'Window has opened'
Runtime Notice: s'NodePath:tables.id-00002'
Runtime Notice: s'Class:table'
Script Error: [string "scripts/CSVTablePaster.lua"]:295: attempt to perform arithmetic on local 'startp' (a nil value)

Here is some sample data that I'm trying to paste:

Achievement,"To overcome obstacles and succeed; to become the best"
Acquisition,"To obtain possessions/wealth"
Adoration,"To be cherished, admired, and wanted by others"
Balance/Peace,To bring all things into harmony and equilibrium
Beneficence,"To protect the helpless, heal the sick, feed the hungry, etc."
Chaos,"To disrupt, to cause confusion and discord"
Competition,"To seek out or create rule,based win/lose scenarios; to defeat others in
contests"
Conflict,"To seek out or create rivalry, fighting, or animosity"
Conquest,"To conquer other peoples, to bring them into one’s own culture/rule"
Corruption,"To despoil, ruin, humiliate, or make depraved"
Creation,"To build or make new, such as art, culture, invention, design,etc."
Destruction,"To annihilate, exterminate, and unmake"
Discovery/Adventure,"To explore, uncover mysteries, and pioneer"

mattekure
November 18th, 2020, 13:22
No dice, I'm completely unable to paste a rollable table. I've turned off all other extensions, but that hasn't made any difference.

error messages in the console

Runtime Notice: s'Window has closed'
Runtime Notice: s'Window has opened'
Runtime Notice: s'NodePath:tables.id-00002'
Runtime Notice: s'Class:table'
Script Error: [string "scripts/CSVTablePaster.lua"]:295: attempt to perform arithmetic on local 'startp' (a nil value)

Here is some sample data that I'm trying to paste:

Achievement,"To overcome obstacles and succeed; to become the best"
Acquisition,"To obtain possessions/wealth"
Adoration,"To be cherished, admired, and wanted by others"
Balance/Peace,To bring all things into harmony and equilibrium
Beneficence,"To protect the helpless, heal the sick, feed the hungry, etc."
Chaos,"To disrupt, to cause confusion and discord"
Competition,"To seek out or create rule,based win/lose scenarios; to defeat others in
contests"
Conflict,"To seek out or create rivalry, fighting, or animosity"
Conquest,"To conquer other peoples, to bring them into one’s own culture/rule"
Corruption,"To despoil, ruin, humiliate, or make depraved"
Creation,"To build or make new, such as art, culture, invention, design,etc."
Destruction,"To annihilate, exterminate, and unmake"
Discovery/Adventure,"To explore, uncover mysteries, and pioneer"

I am still unable recreate the error. when I import using your text it works fine on my machine. For now, I would recommend using the new table importer that is built in to FG. It handles CSV text just fine and largely replaces this extension (for rollable tables). I will take a look, but I may go ahead and retire this extension since the functionality is now built in.

For debugging purposes:
What client are you using (classic/unity?)
What ruleset?
What version of the extension? It will show in the chat on startup, current version is 1.6.

roninkelt
November 18th, 2020, 18:15
I didn't realize there was a built in csv import capability. Will have to dig into that.

For debugging - I'm using FG Classic in the 5e ruleset and the version of the extension is reported as CoreRPG - CSV Table Importer MK 1.6

roninkelt
November 19th, 2020, 00:10
I think I may have figured it out - I was using an older version of the 5e several other rulesets. Apparently, FG prefers the unzipped rulesets over the .pak files. There were several unzipped in my ruleset directory from experimenting with extensions. Removed these and all is well now.

mattekure
November 19th, 2020, 02:26
Ah, awesome. glad to hear it.

Milmoor
March 1st, 2021, 19:57
Thanks, that saves me some awful editing. Unfortunately this does not work with the Worldbuilder (https://www.fantasygrounds.com/forums/showthread.php?54284-Player-Agency-Extension). Solved it by using a link to a story. So I'm good for now. Mainly posting this so others don't have to find out this doesn't work.

Battlewear
May 23rd, 2021, 04:52
Good day, just installed your program today, and Im getting an error when I attempt to import a file.
I watched your video a couple of times and followed along. I actually went as far as saving my text file as a CSV, then opening with notpad ++ and copied that info and tried to import as a table.
I get the following error:
[5/22/2021 9:33:31 PM] [ERROR] Script execution error: [string "mkcsv_button_convert"]:3: ERROR: Invalid CSV field - near character 33 in this line of the CSV file:
"JAC KILL (YOSHI): -EVERYTHING-"

Is there a limit to the amount of text you can have?

I am trying to do this impart with Javins Action Chat Bubbles by creating a series of auto roll tables that will launch when players do certain things like casting specific spells or in this case when Yoshi KILLS something.

mattekure
May 23rd, 2021, 05:20
Good day, just installed your program today, and Im getting an error when I attempt to import a file.
I watched your video a couple of times and followed along. I actually went as far as saving my text file as a CSV, then opening with notpad ++ and copied that info and tried to import as a table.
I get the following error:
[5/22/2021 9:33:31 PM] [ERROR] Script execution error: [string "mkcsv_button_convert"]:3: ERROR: Invalid CSV field - near character 33 in this line of the CSV file:
"JAC KILL (YOSHI): -EVERYTHING-"

Is there a limit to the amount of text you can have?

I am trying to do this impart with Javins Action Chat Bubbles by creating a series of auto roll tables that will launch when players do certain things like casting specific spells or in this case when Yoshi KILLS something.

can you zip up the csv file and post it here so I can take a look and see whats causing it?

Battlewear
May 23rd, 2021, 06:26
can you zip up the csv file and post it here so I can take a look and see whats causing it?

Ummm how do I post it? I tried to insert via the add picture, but that didnt work..

mattekure
May 23rd, 2021, 13:56
Ummm how do I post it? I tried to insert via the add picture, but that didnt work..

On your post, at the bottom click Go Advanced, then there should be a button to manage attachments. then you can upload your zip file and attach it to the message.

Battlewear
May 23rd, 2021, 23:09
On your post, at the bottom click Go Advanced, then there should be a button to manage attachments. then you can upload your zip file and attach it to the message.

Ok, here are the 2 files I basically used for my test.

The intent is to develop a series of files that can be easily imported in for use with this extension.
https://www.dmsguild.com/product/328368/Fantasy-Grounds-Javins-Action-Chat-Bubbles?term=javin

mattekure
May 24th, 2021, 01:20
Ok, here are the 2 files I basically used for my test.

The intent is to develop a series of files that can be easily imported in for use with this extension.
https://www.dmsguild.com/product/328368/Fantasy-Grounds-Javins-Action-Chat-Bubbles?term=javin

I'm a little confused, those are not CSV files. There isnt a single comma in them. Its just a text file with one quote per line. If you are trying to import these into a rollable table, you can do that already with the built in import functions. No need for this extension at all. This is mostly useful for importing grid tables within story entries and such.

you can import you stuff super easy with the built in importer.

https://i.imgur.com/xdMbMgY.png

Battlewear
May 24th, 2021, 01:39
I'm a little confused, those are not CSV files. There isnt a single comma in them. Its just a text file with one quote per line. If you are trying to import these into a rollable table, you can do that already with the built in import functions. No need for this extension at all. This is mostly useful for importing grid tables within story entries and such.

you can import you stuff super easy with the built in importer.

https://i.imgur.com/xdMbMgY.png

Ok, I will give that a shot. I was just trying to do it like what the author showed in his video and suggested your extension.

roninkelt
June 24th, 2021, 07:41
I'm getting this error

[6/23/2021 11:29:17 PM] [ERROR] Script execution error: [string "mkcsv_button_convert"]:3: ERROR: Invalid CSV field - near character 98 in this line of the CSV file:
The Altar of Mother Night,Mountain,2,"A shadar-kai exile prays to Shar, the goddess of darkness."

when trying to import the following csv

Encounter,Category,Tier,Description
The Altar of Mother Night,Mountain,2,"A shadar-kai exile prays to Shar, the goddess of darkness."
The Brass Adventists,Character,1-3,"A selfish adventuring party seeks gold, glory, and power in the Arctic."
The Creeping Igloo,Character,2,"The magical, mobile lair of a bheur hag is a dire sign for the Arctic."
The Crystalline Tavern,Tundra/Urban,1,"The Crystalline Tavern offers warmth, news, and insight to the Arctic."
Deadliest Catch,Sea,1-3,"Crabbers have fished up something far, far above their paygrade."
The Fortress of Solitude,Polar,3,"A bitter aasimar hero broods in his fortress, awaiting the world's end."
The Glacial Garden,Mountain,2,"A medusa haunts a mountain pass, turning victims to ice."

Character 98 is after the last double quote of that line. I can only assume that it's having trouble ending the line for some reason.
Please help.

Zacchaeus
June 24th, 2021, 09:08
Tables can be inported directly into FG now; so I don't think this extension is still needed, And using it will likely conflict with the code in the client.

mattekure
June 24th, 2021, 12:06
I'm getting this error

[6/23/2021 11:29:17 PM] [ERROR] Script execution error: [string "mkcsv_button_convert"]:3: ERROR: Invalid CSV field - near character 98 in this line of the CSV file:
The Altar of Mother Night,Mountain,2,"A shadar-kai exile prays to Shar, the goddess of darkness."

when trying to import the following csv

Encounter,Category,Tier,Description
The Altar of Mother Night,Mountain,2,"A shadar-kai exile prays to Shar, the goddess of darkness."
The Brass Adventists,Character,1-3,"A selfish adventuring party seeks gold, glory, and power in the Arctic."
The Creeping Igloo,Character,2,"The magical, mobile lair of a bheur hag is a dire sign for the Arctic."
The Crystalline Tavern,Tundra/Urban,1,"The Crystalline Tavern offers warmth, news, and insight to the Arctic."
Deadliest Catch,Sea,1-3,"Crabbers have fished up something far, far above their paygrade."
The Fortress of Solitude,Polar,3,"A bitter aasimar hero broods in his fortress, awaiting the world's end."
The Glacial Garden,Mountain,2,"A medusa haunts a mountain pass, turning victims to ice."

Character 98 is after the last double quote of that line. I can only assume that it's having trouble ending the line for some reason.
Please help.

I see what you mean about the error. Oddly it gets two lines just fine, but when you go to 3 lines it fails. This is new behavior as I have used this to import hundreds of lines in a table previously. I may need to refactor the code, FGU has some new API functions available to it that may make it much easier to use


Tables can be inported directly into FG now; so I don't think this extension is still needed, And using it will likely conflict with the code in the client.

FG only has built in table import for Rollable tables. It does not yet have built in CSV import for tables in formatted text fields. So this extension is still useful for those.

mattekure
June 24th, 2021, 16:18
I'm getting this error

[6/23/2021 11:29:17 PM] [ERROR] Script execution error: [string "mkcsv_button_convert"]:3: ERROR: Invalid CSV field - near character 98 in this line of the CSV file:
The Altar of Mother Night,Mountain,2,"A shadar-kai exile prays to Shar, the goddess of darkness."

when trying to import the following csv

Encounter,Category,Tier,Description
The Altar of Mother Night,Mountain,2,"A shadar-kai exile prays to Shar, the goddess of darkness."
The Brass Adventists,Character,1-3,"A selfish adventuring party seeks gold, glory, and power in the Arctic."
The Creeping Igloo,Character,2,"The magical, mobile lair of a bheur hag is a dire sign for the Arctic."
The Crystalline Tavern,Tundra/Urban,1,"The Crystalline Tavern offers warmth, news, and insight to the Arctic."
Deadliest Catch,Sea,1-3,"Crabbers have fished up something far, far above their paygrade."
The Fortress of Solitude,Polar,3,"A bitter aasimar hero broods in his fortress, awaiting the world's end."
The Glacial Garden,Mountain,2,"A medusa haunts a mountain pass, turning victims to ice."

Character 98 is after the last double quote of that line. I can only assume that it's having trouble ending the line for some reason.
Please help.

v1.7 was uploaded with a fix for this.

roninkelt
June 24th, 2021, 16:57
thanks for such a prompt reply.

That worked perfectly.

Re: the FG table import, as mattekure said it's good for rollable tables but doesn't do text tables in story entries, which is what I was doing here and will need to do many times in my current project. The FG table import is highly useful, but doesn't cover my current use case.

Zacchaeus
November 15th, 2021, 15:11
Just a heads up. This doesn't work with the current test version of FGU. The hammer icon isn't present.

mattekure
November 15th, 2021, 15:44
Just a heads up. This doesn't work with the current test version of FGU. The hammer icon isn't present.

thanks, I'll take a look


LOL, the function I was using to register the button now consists of one line saying "Debug.console("DesktopManager.registerStackShortcuts - DEPRECATED - 2021-10-15");"

I'll switch over to the new function

mattekure
November 15th, 2021, 16:06
Ok, I pushed a build to test that should fix it. Also fixed an issue with it not showing up in 2e

Zacchaeus
November 15th, 2021, 17:33
thanks, I'll take a look


LOL, the function I was using to register the button now consists of one line saying "Debug.console("DesktopManager.registerStackShortcuts - DEPRECATED - 2021-10-15");"

I'll switch over to the new function

hehe

Zacchaeus
November 15th, 2021, 17:37
Ok, I pushed a build to test that should fix it. Also fixed an issue with it not showing up in 2e

Perfect button now present and correct.

nephranka
December 16th, 2021, 22:17
I was looking around and noticed the button is missing in the new release. Maybe I am missing something? I did remove the ext and re dled it from the forge.

mattekure
December 16th, 2021, 23:14
I was looking around and noticed the button is missing in the new release. Maybe I am missing something? I did remove the ext and re dled it from the forge.

Yeah, I already have the fix for it in the test environment. I am having issues with the forge right now and cannot get in to push it to Live. As soon as I get access again, I'll push the fix.

nephranka
December 16th, 2021, 23:42
Yeah, I already have the fix for it in the test environment. I am having issues with the forge right now and cannot get in to push it to Live. As soon as I get access again, I'll push the fix.

Thanks!

mattekure
December 16th, 2021, 23:44
Thanks!

It should be available now.

nephranka
December 17th, 2021, 01:03
It should be available now.

All good now. Thanks!

pizentios
January 20th, 2022, 18:38
currently trying to import a list of names using this tool, haven't been able to get it to import as a table, but importing into a story as per instructions works fine. I've read the documentation in this thread and watched the video. Nothing i try can get the import to a rollable table feature to work. Not sure if it's me or something has changed with regards to the FGU environment. I've even loaded a new campaign with the CSV importer extension being the only thing loaded and still get the same results.

Very much want to make use of this tool. Thanks for any insights that might be provided.

mattekure
January 20th, 2022, 18:40
currently trying to import a list of names using this tool, haven't been able to get it to import as a table, but importing into a story as per instructions works fine. I've read the documentation in this thread and watched the video. Nothing i try can get the import to a rollable table feature to work. Not sure if it's me or something has changed with regards to the FGU environment. I've even loaded a new campaign with the CSV importer extension being the only thing loaded and still get the same results.

Very much want to make use of this tool. Thanks for any insights that might be provided.

Importing into a rollable table was built into FG natively, so this extension is no longer needed for that. So this extension primarily supports importing into story entries.

pizentios
January 20th, 2022, 19:05
Importing into a rollable table was built into FG natively, so this extension is no longer needed for that. So this extension primarily supports importing into story entries.

Great thanks for the quick reply. In the mean time, i was able to figure out how to use the native tool for what i wanted. Thanks again, i still have use for this tool, so thanks very much for the work put into it!

digimatt
March 19th, 2022, 00:06
If the table has an ampersand (&) in it anywhere, I'm getting the following error when converting:
FormattedText SetValue XML Error: an error occurred while parsing EntityName. Line 1, position 160.

dmbrown
April 21st, 2022, 15:03
I have a campaign with only this extension and when I click on Convert clipboard I get the following error:
[ERROR] Script execution error: [string "scripts/CSVTablePaster.lua"]:295: attempt to perform arithmetic on local 'startp' (a nil value)
and nothing is placed into my story entry and I've placed the #table# there.

mattekure
April 21st, 2022, 20:06
I just pushed an update to version 1.8. This changes how CSV import is done. The new method allows you to select a CSV file, then import it. No more relying on the clipboard.

https://i.imgur.com/4vfxCcH.png

dmbrown
April 21st, 2022, 22:39
Thank you sir and that is why I’ve bought some of your extension. :D

mattekure
May 5th, 2022, 00:13
Just pushed another update. I am no longer doing any custom CSV parsing myself, instead I am using the built in CSV parsing functions provided by FG. Also greatly simplified usage. Just put the #table# into the record, click the import CSV button and select your file. thats it.

darrenan
May 5th, 2022, 19:03
Any chance we could get this working with formattedtext text blocks in reference pages? Would be nice to be able to import tables when building reference manuals.

mattekure
May 5th, 2022, 19:06
Any chance we could get this working with formattedtext text blocks in reference pages? Would be nice to be able to import tables when building reference manuals.

Great idea! The refman builder didnt exist when I made this so I never considered it. I'll see if its possible.

mattekure
May 5th, 2022, 21:16
v1.11 just uploaded. Added the ability to import tables into Ref man pages.

Note, in order to do this, you have to open the page itself, not from within the builder.

new video added to first post.

https://i.imgur.com/kWKzK1q.png

https://i.imgur.com/dGktTMu.png

darrenan
May 8th, 2022, 17:00
Thank you so much. I'm doing a conversion with a lot of tables in it, the ref man page support is going to be a big time-saver.

_JackDoor_
May 10th, 2022, 22:08
Thank you for your hard work, saved me hours of worthless typing!

mattekure
May 10th, 2022, 23:26
I'm glad people still find it useful

dubyaguy
September 1st, 2022, 16:54
Fantastic tool! Thank you!

Stargrove
December 14th, 2023, 01:11
After the latest FGU update I am getting an error:


[ERROR] Script execution error: [string "CSV-Table-Importer:CSVImportManager.lua"]:106: attempt to call field 'registerSidebarStackButton' (a nil value)

Hopefully this extension is still being supported as I find it quite useful when building modules.

Thanks

mattekure
December 14th, 2023, 01:58
After the latest FGU update I am getting an error:


[ERROR] Script execution error: [string "CSV-Table-Importer:CSVImportManager.lua"]:106: attempt to call field 'registerSidebarStackButton' (a nil value)

Hopefully this extension is still being supported as I find it quite useful when building modules.

Thanks

I just pushed a fix about 2 mins ago, please update and try again. Thanks!