Book a Demo

Author Topic: Reading XLS/CSV by script  (Read 7163 times)

Wojtas

  • EA User
  • **
  • Posts: 26
  • Karma: +0/-0
    • View Profile
Reading XLS/CSV by script
« on: February 25, 2015, 12:40:28 am »
Hi,

I'm looking for point of start for such task. I have Excel file that contain list of systems. I prepared tree, TV's, etc. Now I need to read file line by line and create component-type elements. I create function that check does element exists in repo, if not new element is created. Problem is how to read external file.

Thanks in advance 4 help ;)

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Reading XLS/CSV by script
« Reply #1 on: February 27, 2015, 01:31:51 am »
Check the pre-defined EA scripts. There is one to read a CSV.

q.

Aaron B

  • EA Administrator
  • EA User
  • *****
  • Posts: 941
  • Karma: +18/-0
    • View Profile
Re: Reading XLS/CSV by script
« Reply #2 on: February 27, 2015, 09:23:23 am »
The CSV scripting library that qwerty mentioned can be found under Tools | Scripting > EAScriptLib > JScript-CSV.

You can find some CSV import and export script examples which use this library on the following pages:
http://www.sparxsystems.com/cgi-bin/yabb/YaBB.cgi?num=1396310555/0#1
http://www.sparxsystems.com/cgi-bin/yabb/YaBB.cgi?num=1396913036/0#1

Wojtas

  • EA User
  • **
  • Posts: 26
  • Karma: +0/-0
    • View Profile
Re: Reading XLS/CSV by script
« Reply #3 on: February 27, 2015, 07:45:07 pm »
Hi,

thanks a lot guys. Helped a lot. Should train search usage ;)

Kind regards,
Wojtek

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Reading XLS/CSV by script
« Reply #4 on: February 27, 2015, 08:03:49 pm »
You can also use my existing VBA excel importer and modify it to suit your needs.
Most of the code you'll need is already there.

Geert