cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to run sql query on excel workbook?

S0024009236
Participant
0 Likes
752

Hello experts,

How do we run SQL query on excel workbook in iRPA cloud studio.

Tried imitating this blog post which is meant for desktop studio with a little modification in code.

The following error is thrown. "ActiveXObject is not defined".

Please suggest if there is any solution.

        var cn = new ActiveXObject("ADODB.Connection");
 	var strConn = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source = 'C:\\Users\\Administrator\\Downloads\\abc.xlsx';Extended Properties='Excel 12.0;HDR=Yes'";
	cn.Open(strConn);
	var rs = new ActiveXObject("ADODB.Recordset");
	var SQL = "select * from [Sheet1$] where [Group Indicator] is not null";
	rs.Open(SQL, cn);
	var index=0;
	 while(rs.EOF != true){
		rs.MoveNext();
		index++;
         }
	rs.Close();
	cn.Close();

Accepted Solutions (0)

Answers (1)

Answers (1)

janv7306
Active Participant
0 Likes

Hello Bhushan,

I am using Execute Macro feature in IRPA Excel SDK. And I keep all macros in a separated excel file. It allows me having all programming code separated.

Regards,

Jan