/ClockifyExport

Exports and post-processes Clockify shared reports

Primary LanguageC#MIT LicenseMIT

ClockifyExport

The tool exports data from a Clockify shared report, groups the entries for the same day, and saves it as JSON or CSV with the following fields:

  • Date: Date of the grouped time entry. Non-parsed string as it appears in the Clockify shared report CSV.
  • Group: Project or task of the grouped time entry.
  • Hours: Sum of time for the grouped time entry, expressed as total hours (with decimal part).
  • Description: All descriptions for the grouped time entry, each in its own line.

You need the following information from Clockify to invoke the tool:

Installation

You can install the latest version as a global .NET tool from the NuGet Gallery with the following command:

dotnet tool install -g DamirsCorner.ClockifyExport

Alternatively, you can download the NuGet package from the GitHub Releases page and install that package with the following command:

dotnet tool install -g DamirsCorner.ClockifyExport --add-source "."

The command assumes the downloaded package is located in the current directory. If not, change the --add-source value to point at the directory containing the package.

Usage

Usage: clockifyexport [options]

Options:
  -a|--api-key <API_KEY>              Clockify API key.
  -i|--report-id <REPORT_ID>          Clockify shared report ID.
  -s|--start-date <START_DATE>        Report start date (inclusive).
  -e|--end-date <END_DATE>            Report end date (inclusive).
  -g|--grouping <GROUPING>            Column to group by time entries within a day.
                                      Allowed values are: ByTask, ByProject.
  -r|--round-up-to <ROUND_UP_TO>      Number of minutes to round duration up to after grouping.
  -t|--task-id-regex <TASK_ID_REGEX>  Regex to use for task id parsing.
  -f|--format <FORMAT>                Export format.
                                      Allowed values are: Csv, Json.
  -o|--output <OUTPUT>                Output file.
  -b|--base-url <BASE_URL>            Base URL of the Clockify Reports API.
                                      Default value is: https://reports.api.clockify.me/.
  -?|-h|--help                        Show help information.

Sample call:

clockifyexport --api-key YourApiKey --report-id YourReportId --start-date 2024-01-01 --end-date 2024-01-31 --grouping ByTask --round-up-to 15 --format Csv --output out.csv --task-id-regex [A-Z\\d]+\\-\\d+

Troubleshooting

In the project repository (in the .bruno folder), you can find a Bruno collection with a few API calls. Use them to test the API key and report ID values you are providing to the tool.

  • Get user: Returns your user data. Use it to confirm that your API key (apiKey secret in Bruno environment) is working.
  • Get workspaces: Returns a list of your workspaces.
  • Get shared reports: Returns a list of shared reports in a workspace (workspaceId secret in Bruno environment: set its value to id from the Get workspaces call).
  • Generate shared report: Returns a generated shared report in CSV file (reportId secret in Bruno environment: set its value to id from the Get shared reports call). Set the date range to your liking. The same call is used by the tool.