- A plugin inspired by godot-csv-typed-importer
- Basically a wrapper for sep csv parser.
- Import csv table and access the data with C# and GDscript code!
- helper class and extension method to speed up your workflow
- Upgrades the project to 4.6
- now support csvdata tsvdata as fileExtension
- add extension method and attribute class to help with data convert
Godot 4.6 fixed the csv bug and force open csv as text in text editor. The imported resource is not visible currently in editor mode but the run time is not affected.
- Add Sep Package to your .csproj file
- Build the project and enable the plugin.
<Project Sdk="Godot.NET.Sdk/4.5.1">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<EnableDynamicLoading>true</EnableDynamicLoading>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Sep" Version="0.12.2" />
</ItemGroup>
</Project>- Header (1st row) is needed
- Support Comma or tab Separator, or you can use Auto and leave it the sep to decide.
- Check sep to see more detail
- 2rd row can be set as type indicator.
- Current Supported Type: int/float/string/bool/json
- json type uses the godot str_to_var native calls
- Skip row can be set to skip a second header row.
id,foo
string,string
ID,FOO
1,Hello
2,Worldusing CSVDataImporter;
using Godot;
[GlobalClass]
public partial class Foo : RefCounted, IIndexed
{
public StringName ID { get; set; }
[ColumnName("foo")] public string FOO { get; set; }
public override string ToString()
{
return $"ID: {ID}, FOO: {FOO}";
}
}using CSVDataImporter;
using Godot;
public partial class CSharpLoadFirst : Node
{
public override void _Ready()
{
}
public Foo GetFoo(string id)
{
var data = GD.Load<CSVData>("res://scripts/Foo.csv");
if (data == null)
{
GD.PrintErr("Failed to load CSV data.");
return null;
}
var foo = data.ParseRow<Foo>(id);
return foo;
}
}func _ready():
var c = get_node("%CSharpLoader")
var foo = c.GetFoo("1")
print("Got foo: %s" % foo)
Copyright (c) 2025 Luoshark
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
