Query Data in an Excel File

Problem description & analysis

Below is the content of Excel file users.xlsx:

name

age

height

user_1

35

185

user_2

18

164

user_3

55

194

We are trying to find record where name is user_1. Below is the desired result:

name

age

height

user_1

35

185

Solution

Write the following script p1.dfx in esProc:

A

1

=file("users.xlsx").xlsimport@t()

2

=A1.select(name==username)

Explanation:

Set value of script parameter username as user_1.

A1  Import data of the Excel file and return it as a table sequence.

A2  Get record where name value is equal to value of parameter username from A1’s table sequence.

Read How to Call an SPL Script in Java to learn about the method of integrating the SPL script into Java.

Q & A Collection

https://stackoverflow.com/questions/62571193/how-can-i-get-a-specific-cell-value-from-an-excel-file