Write datatable to excel sheet2 using Excel as Database approach

Hello Everyone,

I have one datatable that contains employee ID, name, and salary.

I want to write this datatable using excel as database approach.

I used below query in “Run command” activity but it is throwing syntax error in ‘create table statement’

"Create table [Sheet2$] as Select [Employee ID], [Employee Name], Salary from [Sheet1$] where Salary > 500000 "

Please help me to resolve this error and write the datatable to sheet2.

Thanks,
Kalyan

Hi @kalyan_g ,

Could you provide us the Error Screenshot ?

We would like to know what is the exact error message stated.


Hi Arpan,

I have uploaded the screenshot,

Thanks,
Kalyan

Hi @kalyan_g ,

Apologies for the late response, Could you try the below modified Query if you have not found a solution yet :

Create table [Sheet2$] as (Select [Employee ID], [Employee Name], Salary from [Sheet1$] where Salary > 500000)

Let us know if it still doesn’t work or if you have found the solution already please post it.

Thank you Arpan,

I will try and will let you know,

Kalyan

I’m curious why you want to do it this way instead of just using Write Range which is very simple.

Hi Postwick,

Yes, as you mentioned using write range is simple and quick, I also used that to solve the problem after some hours I started the thread

But I am curious to know if there is a possibility using SQL query.

1 Like