-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Godot can't load CSV file as TextFile resource #38245
Comments
CC @willnationsdev as he worked on some CSV related import stuff. |
Afaik, the TextFile class only has usability from the editor itself (there's no API exposed for working with it). You can only open a TextFile directly in the ScriptEditor and save it. I don't think it works when you try to export it as a property, but I haven't really tried much. |
@willnationsdev I see. But CSV files are not being loaded even as normal resources; is this normal? |
As I understand it, |
That's weird because there is a 'normal' CSV importing option on the file itself, along with the 'Localization CSV' option. If it can't be imported as a regular resource, what is its purpose? Should I be able to import non-resource, non-object files to the project? |
@henriquelalves Not sure. Maybe I'm misunderstanding something about it. Would have to check back through the source code. |
The workaround is to rename your yourfile.csv file to yourfile.csv.txt example code:
|
I suppose we should change the file extension for translation CSVs to something else. This would require people exporting CSVs from LibreOffice to rename the extension manually though. |
See #36297 |
Same here. The CSV import option makes it unable to load the file in any exported game. Moreover, if I RENAME the .csv file which imported as CSV in the filesystem dock to .txt file, the .csv.import file created by the editor will NOT be deleted, it's just renamed to .txt.import and the content is untouched leaving something like:[dep]
|
@YLL I feel like the import issue is a slightly different problem that should have its own bug issue. If the same PR can fix both problems at once, then great, but otherwise, you wouldn't want to close this Issue if only one part of the problem was resolved. If you make a bug Issue, make sure to mention this one so that people know they're related. |
Does anyone still have this issue in 3.2.3 stable and 3.2.4? I can load and parse |
I can parse csv files with
|
@henricazottes Select the CSV file in the FileSystem dock, go to the Import dock, change the import type from Translation to CSV then click Reimport. |
Thanks @Calinou , now I have this error when I double click on it:
Is it supposed to display the data / be editable ? |
No, Godot doesn't have a built-in CSV editor. Out of curiosity, can you upload the CSV file here (in a ZIP archive)? Make sure it's UTF-8 encoded without BOM. Microsoft Excel will create incorrectly encoded CSV files; use LibreOffice Calc or Google Sheets instead. |
So the error above is normal? Here you go ( |
Yes, I think it's expected since importing it as a pure CSV file will make sure Godot doesn't treat it as a translation during the exporting process. |
The no-op "CSV" importer is removed by #47301 as it's superseded by #47268 - you can now configure This doesn't allow actually editing the CSV files in the GDScript editor, but this issue seems to have mostly comments related to the workflow of avoiding CSV files from being used as translations, which is now properly fixed. The whole TextFile business is quite limited in its current implementation (see #36297), and the needs for manual editing of CSV in the editor might be better served by godotengine/godot-proposals#13. |
Hello, I am having the same problem in godot 4 and I not found another post with this issue. I can work with the csv files, the only problem is than upset me the 2 error lines for every csv file, even changed to UTF-8 and not worked and if I go to import window I can't interact with they. The txt works fine and delete the problem, but I want to have a few CSV, and I would like not change the file type every moment. I am new in godot and there is so many thing than I don't understand, I assume than there is a problem created just by me. |
I still get this error in 4.3.dev5.mono: And the Import dock show nothing. Is it normal ? Am I missing something ? |
Godot 4.2.1. stable Can't import any csv keys;en |
@pozitiffcat If your CSV uses semicolons as separators, you need to change the separator to Also, make sure the CSV file is UTF-8 encoded without BOM. Microsoft Excel will create incorrectly encoded CSV files; use LibreOffice Calc or Google Sheets instead. |
If your file does not use a comma separator (or have any other problem making the translation importer fail) when you're importing it, the Import dock will not shows up (see #82002). I had this problem, the only way out I found is to make the file a "valid csv" (like a file with content:",\n"), changed its import options, and changed the csv back. Hope this helps :) |
It helped me. Not able to import CSV first time with semicolon separator. Import settings is empty. |
Godot version: 3.2.1 (Stable)
OS/device including version: Manjaro
Issue description: Godot doesn't seems to be able to load non-localization CSV files in the editor. Trying to load it in any
export(Resource) var
orexport(TextFile) var
gives:and clicking it twice gives:
Not sure if it is related, but are
.txt
files supposed to be hidden in Editor? Trying to change a .csv file to .txt makes it impossible to be selected as a file in the inspector.Steps to reproduce: Any .CSV file in the project (imported as a normal CSV file, not localization) should be able to reproduce this.
Minimal reproduction project: Annexed to the issue.
csv-problem.tar.gz
The text was updated successfully, but these errors were encountered: