Aveva. PML. Read data from excel(.xls)

Sometimes its need to read data from excel file not just .csv file, import data from some external source. With such little macro you can do it.


–Open Forms\Hide
show !!spreadsheetimport
hide !!spreadsheetimport
!!spreadsheetImport.setDataHandler(object EQUILOADER())
!!spreadSheetImport.filename.val = ‘c:\PipeImport.xls’ $* Excel PATH
–Find first column names
!array = ARRAY()
do !rowVals values !!spreadSheetImport.dataGrid.getrows()
!row = ”
do !rowVal indice !rowVals
!sep = ”
!sep = ‘ ‘
!row = !row + !sep + !rowVals[!rowVal]
q var !array

[1] ‘100-B-1 PIPE 1’
[2] ‘100-B-2 PIPE 2’

This file need to be place here ‘c:\PipeImport.xls’ to test my code.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.