You can use an Excel Macro to get data from a terminal screen and put it into a spreadsheet.
If you prefer to run macros in pre-configured sessions instead of creating your own sessions, you can download the VBA Sample Sessions and open the get-ibm-screen-data-with-an-excel-macro.xlsm (IBM) and the get-os-screen-data-with-an-excel-macro.xlsm (Open Systems) files. The download package contains everything you need to run the macros in these files. See Download the VBA Sample Sessions.
This sample uses the GetText method to get data from a session.
First, the sample creates an InfoConnect session. The IBM sample does this by creating a new session and then assigning it the demo Host/IP address. The Open System sample opens an existing session. For details about concepts related to this part of the sample, see Create a Session From a Microsoft Excel Macro and Open a Session From a Microsoft Excel Macro.
Then it navigates through the session to get to the screen data we want to copy.
When the program is on the screen with the data, the GetText method is used to get a row or data as a string. The Replace function is used to handle compound words and to remove unwanted characters and the Excel Trim function is used to remove all extra leading and trailing spaces and spaces between words. Then the string is converted to an array.
Finally, the sample loops through the array and assigns the value of each element to a cell in the spreadsheet.
This process is repeated until the macro encounters an empty row.