This site requires JavaScript to be enabled
IE BUMPER

Logo

Dear Tricentis qTest users,

If you would like to submit a Tricentis qTest ticket,

please use this support request form.

Tosca Version
IncidentLookup using list
Language
How can we help?

Solution Suggestions

Please enter your question to get suggestions.
  Help
IE BUMPER
Categories
Boolean Operators
OR or vertical bar symbol (|)
Finds a match if either the terms exist in a document (a union using sets).
AND
Finds a match if both terms exist in a document (an intersection of sets).
NOT, minus (-), or exclamation point (!)
Excludes documents that contain the term after NOT (a difference of sets).
Wildcards
Asterisk (*)
The asterisk symbol performs a multi character wildcard search.
Percent sign (%)
The percent sign performs a single character wildcard search.
Phrases
Quotation marks (")
Use quotation marks to search for an exact phrase with multiple terms.
For examples and more information look at our Knowledge Base: Advanced Search On The Support Portal

Exporting table/sql result to an Excel/csv

The Problem

If you want to save the result of a sql query or a table in an excel file via Tosca, there is limited approach to do it. You may have to loop through the records and save them in an excel which will take a long time.

 

A Solution

Using PowerShell and Tosca, you can do it in a seconds. You can save the result to your local machine as well as a shared drive.

 

An Example

 

Use the “TBox start program” from Tosca to start the PowerShell. (C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe)

 

Enter the query as an argument and run.

 

$Connection = 'Driver={SQL Server Native Client 11.0};Server=Your_Server;Database=Your_Database;Uid=YourUsername;Pwd=YourPassword;'

 

Send-SQLDataToExcel -Connection $Connection -SQL  "SELECT TOP 10 *  FROM Your_TableName" -Path 'C:\Temp.xlsx' -WorkSheetname Your_WorkSheetName

  

 

Note:

·         Make sure to install “ImportExcel” module before trying the solution. ( If you are an admin ignore the parameters “-Scope CurrentUser” )

 

Install-Module ImportExcel -Scope CurrentUser

 

·         You can also use Windows authentication instead of enter username and password. Refer here for the complete list.

 

·         Similar to this, you can also save your result as “.csv” using the module  ConvertTo-Csv.

0 0

Abhilash Tomar

Created: 2019-04-01 12:27:25

Hi

could you provide how to install "ImportExcel"

it will be great you share the screen shot of these task implementation.

 

 

Pugazhvanan Ganapathy

2019-04-23 19:27:10

Hi ABHILASH,

It is in the note section. Install-Module ImportExcel is used to install the ImportExcel module. I will definitely provide the screenshots soon. Thank you!

Thanks,

Pugal

IE BUMPER

Tosca is the perfect solution

Optimize - Manage - Automate

Download Trial