Module created to allow for easy extraction of Time Data from Toggl's API, via PowerShell Invoke-WebRequest cmdlets. For use with other cmdlets and scripts.
Clone the repository into your $Home\Documents\WindowsPowerShell\Modules folder (create the Modules folder if you dont have one already)
cd $Home\Documents\WindowsPowerShell\Modules\
git clone git@github.com:mikepruett3/ps-toggldl.gitThen you can import the custom module into your running shell...
Import-Module ps-toggldlRunning this function will create a Global Variable which is used with subsequent functions of this module.
This function is looking for two User-Defined Environment Variables:
| Variable | Description |
|---|---|
| Toggl_Api | The API key provided by Toggl.com |
| Toggl_Workspace | The Workspace ID provided by Toggl.com |
Once you have these Environment Variables, run the following:
Connect-TogglIf no User-Defined Environment Variables are defined, the function is expecting these as Parameters:
Connect-Toggl -Apitoken <Toggl-API-Token> -Workspace <Workspace-Token>Retrieving Time Entry Data from Toggl's API can be performed by the following:
Get-SummaryWhich will return a PowerShell Object of all of the data from the last 24 hours (Earliest point at midnight). You can use the -Detail method to retrieve full Time Entry data, instead of a summary
Get-Summary -DetailIf you want to return data from an older point, you can provide a negative integer in the -Days method.
Get-Summary -Days -5You can also use the following to retrieve the data, and place it in a CSV file
Get-Summary | Export-Csv -Path \path\to\file\<filename.csv> -NoTypeInformationImportant to use the -NoTypeInformation, to strip the type information from the CSV file