Discover how a bimodal integration strategy can address the major data management challenges facing your organization today.
Get the Report →Pipe TSheets Data to CSV in PowerShell
Use standard PowerShell cmdlets to access TSheets tables.
The CData Cmdlets Module for TSheets is a standard PowerShell module offering straightforward integration with TSheets. Below, you will find examples of using our TSheets Cmdlets with native PowerShell cmdlets.
Creating a Connection to Your TSheets Data
TSheets uses the OAuth2 standard for authentication and authorization. To construct your own OAuth app and connect to data, refer to OAuth section in the Help.
$conn = Connect-TSheets -OAuthClientId "$OAuthClientId" -OAuthClientSecret "$OAuthClientSecret" -CallbackUrl "$CallbackUrl"
Selecting Data
Follow the steps below to retrieve data from the Timesheets table and pipe the result into to a CSV file:
Select-TSheets -Connection $conn -Table Timesheets | Select -Property * -ExcludeProperty Connection,Table,Columns | Export-Csv -Path c:\myTimesheetsData.csv -NoTypeInformation
You will notice that we piped the results from Select-TSheets into a Select-Object cmdlet and excluded some properties before piping them into an Export-Csv cmdlet. We do this because the CData Cmdlets append Connection, Table, and Columns information onto each "row" in the result set, and we do not necessarily want that information in our CSV file.
The Connection, Table, and Columns are appended to the results in order to facilitate piping results from one of the CData Cmdlets directly into another one.