Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

LOAD SQL queries from excel sheet into qlikview.

I have some set of SQL queries in excel sheet and I want to load this queries in Qlikview and perform the SQL queries in Qlikview.

Can anyone help on the same?

1 Solution

Accepted Solutions
flipside
Partner - Specialist II

You can load your queries direct from the Excel file and pass the query into a variable like this example ...

/*Example Data (held in Excel file called SavedQueries.xslx)

QueryID     QueryDesc          Query
1       OrdersDelivered           SELECT OrderID, OrderStatus FROM Orders WHERE OrderStatus = 'Delivered'
2       OrdersOutstanding       SELECT OrderID, OrderStatus FROM Orders WHERE OrderStatus = 'Outstanding'
3       OrdersInProgress         SELECT ….
4       OrdersPaused              SELECT ….
5       InvoicedByMonth          SELECT InvoiceMonth, sum(InvoiceValue) as TotalInvoiced FROM Invoices Group By InvoiceMonth

*/


Queries:
LOAD QueryIDQueryDescQuery FROM SavedQueries.xlsx (ooxml, embedded labels, table is Sheet1);

//Lookup the value 'InvoicedByMonth' in field 'QueryDesc' in table 'Queries' and return the value in field 'Query'
//Values in QueryDesc must be unique
Let SQLCmd = Lookup( 'Query', 'QueryDesc', 'InvoicedByMonth', 'Queries' );

OLEDB CONNECT TO [...] (XPassword is ...);

InvoicedByMonth:
Load *;
SQL $(SQLCmd);

flipside

View solution in original post

5 Replies
Anil_Babu_Samineni

Should share that Queries with us, Or else how we understand which Query you have? All SQL may / May not implement in Qlikview. But, Qlik has that power

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
awhitfield
Partner - Champion

Copy and Paste??

Not applicable
Author

I have some basic list of queries for oracle which works very well in Qlikview.

eg: desc table name ;

Select count(*) from table name;

select * from table name;

I want to extract that query and run in qlikview.

flipside
Partner - Specialist II

You can load your queries direct from the Excel file and pass the query into a variable like this example ...

/*Example Data (held in Excel file called SavedQueries.xslx)

QueryID     QueryDesc          Query
1       OrdersDelivered           SELECT OrderID, OrderStatus FROM Orders WHERE OrderStatus = 'Delivered'
2       OrdersOutstanding       SELECT OrderID, OrderStatus FROM Orders WHERE OrderStatus = 'Outstanding'
3       OrdersInProgress         SELECT ….
4       OrdersPaused              SELECT ….
5       InvoicedByMonth          SELECT InvoiceMonth, sum(InvoiceValue) as TotalInvoiced FROM Invoices Group By InvoiceMonth

*/


Queries:
LOAD QueryIDQueryDescQuery FROM SavedQueries.xlsx (ooxml, embedded labels, table is Sheet1);

//Lookup the value 'InvoicedByMonth' in field 'QueryDesc' in table 'Queries' and return the value in field 'Query'
//Values in QueryDesc must be unique
Let SQLCmd = Lookup( 'Query', 'QueryDesc', 'InvoicedByMonth', 'Queries' );

OLEDB CONNECT TO [...] (XPassword is ...);

InvoicedByMonth:
Load *;
SQL $(SQLCmd);

flipside

Not applicable
Author

Thanks for the answer.