CODESYS - the IEC 61131-3 automation software
https://forum.codesys.com/

Import / export Global Variable list using csv/excel
https://forum.codesys.com/viewtopic.php?f=11&t=6881
Page 1 of 1

Author:  vincent.devillers [ Wed Apr 27, 2016 10:08 am ]
Post subject:  Import / export Global Variable list using csv/excel

Hi,

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

Author:  TimvH [ Wed Apr 27, 2016 10:33 am ]
Post subject:  Re: Import / export Global Variable list using csv/excel

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.

Author:  khoadio [ Tue Dec 18, 2018 2:48 pm ]
Post subject:  Re: Import / export Global Variable list using csv/excel

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.

Note:
- 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.

Author:  dFx [ Tue Dec 18, 2018 2:59 pm ]
Post subject:  Re: Import / export Global Variable list using csv/excel

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)

Page 1 of 1 All times are UTC+01:00
Powered by phpBB® Forum Software © phpBB Limited
https://www.phpbb.com/