Originally created by: vincent.devillers
I am using CODESYS V3.5 SP8 Patch 2
Is there a way to import / export Global variable list using CSV files?
So we can generate variable lists in Excel and then import them in CODESYS.
with kind regards
When you use tabs in the declaration of the variables in CODESYS (textual view), then you can just copy/paste the variables to/from Excel.
Excel will use the Tabs to place the text in individual columns.
I have been working on this task for few day and I had solution for it. Following the steps:
1/ Create Format of CSV file from Excel
Need to have header: TextList ID Default (and optional different languages, for instances)
In the TextList column, insert textlist name for every rows.
2/ Create UTF-8 CSV to keep the Unicode font when importing to CODESYS.
This step is required if you want to import UTF-8 text such as Germany characters
- Create Excel content as step 1
- Save As → Save as Type: CSV (Comma DElimited)(*.csv) → Tools → Web Options → Encoding → Save this document as: Unicode (UTF-8) → Fonts → Characters Set: Multilingual/ Unicode/Other Script → OK
3/ Add CSV file into a new text list of CODESYS.
- Right Click Application in CODESYS --> Add Object --> Text List --> Any Name
- Double Click on new Text List just created --> In Textlist Tab from Menu Bar --> Import/Export Text List File --> Choose File to COmpare or to Export --> Browse to the CSV file you created from step 2.
- Choose Import.
--> New Text List with the name in CSV file will appear.
- it is not required the ID column have to be number. You can insert words as well.
- It is required to have an exact format for assigning text index. The text should be placed in ' ' mark. Example: 'Start'.
- Case sensitive.
- When importing more lists into 1 project, CODESYS automatically add all headers in every list together.
Unicode/UTF-8 is not a font, it's a character encoding.
currently I'm using Notepad++ for mass import. (you can open a CSV from it, and play with nice replace functions like regex)
Log in to post a comment.