Highlighted
Absent Member.
Absent Member.
1835 views

[archive] I am trying to read from excel

[Migrated content. Thread originally posted on 03 March 2003]

CREATE @Application OF @Excel HANDLE IN EXCEL-APP.
MODIFY EXCEL-APP @SheetsInNewWorkBook = 1.
MODIFY EXCEL-APP @GetOpenFilename()
GIVING FIELD.


MODIFY EXCEL-APP @Workbooks::Open(FIELD)
GIVING EXCEL-WORKBOOK.

MODIFY EXCEL-APP @VISIBLE = 1.


inquire EXCEL-WORKBOOK
@application::Worksheets() in EXCEL-WORKSHEET.
>>> this give a handle but ot the one that the active worksheet


MOVE "A1" TO excel-CELL-RANGE.
MOVE "Quarterly Sales Figures for 2002" TO field.

MODIFY EXcel-WORKSHEET
@Range(excel-CELL-RANGE)::Value = field.
0 Likes
3 Replies
Highlighted
Absent Member.
Absent Member.

RE: [archive] I am trying to read from excel

If I may be so liberate, it is not quite obvious what is your problem, please provide some more explanation next time.

However, as your subject is: "I am trying to read from excel", I suppose what you want is how to get the content from a cell.

This is how you would extend your current sample to do that:

INQUIRE EXcel-WORKSHEET
@Range(excel-CELL-RANGE)::Value IN field.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] I am trying to read from excel

At first i try to inquire but still have the error is member not found.


inquire EXCEL-WORKBOOK
@application::Worksheets() in EXCEL-WORKSHEET.

For me is the handle excel-worksheet that seen to don't have the correct value.

So i try that

CREATE @Application OF @Excel HANDLE IN EXCEL-APP.
MODIFY EXCEL-APP @SheetsInNewWorkBook = 1.
MODIFY EXCEL-APP @GetOpenFilename()
GIVING FIELD.

MODIFY EXCEL-APP @Workbooks::Open(FIELD)
GIVING EXCEL-WORKBOOK.

MODIFY EXCEL-APP @VISIBLE = 1.


inquire EXCEL-WORKBOOK
@application::Worksheets() in EXCEL-WORKSHEET.


MOVE "A1" TO excel-CELL-RANGE.
inquire EXcel-WORKSHEET
@Range(excel-CELL-RANGE)::Value = field.

And i have the error invalid member or something like that.

Thank for your reply!
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] I am trying to read from excel

Worksheets is a collection so you need to specify which item in the collection you want, for instance the first sheet is 1 :

inquire EXCEL-WORKBOOK
@Worksheets::Item(1) in EXCEL-WORKSHEET.

or by name:

inquire EXCEL-WORKBOOK
@Worksheets::Item("Sheet1") in EXCEL-WORKSHEET.
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.