Here is an example of how to retrieve reports from TimeTrex in Google Sheets.
- Login to TimeTrex and create a saved report containing the data that you wish to view in Google Sheets. For simplicity sake the report name should be a single word without any special characters or spaces, ie:
Code: Select all
MyReportForGoogleSheets
- Because Google Sheets doesn't support loading data from secure authenticated sources out-of-the-box, you will need to add a custom script that supports this functionality. Open ImportJSON custom script in your browser, then select all and copy its entire contents to your clip board.
*IMPORTANT* DO NOT share this spreadsheet or allow anyone else access to view the code or modify it, as they will be able to see your password and use it to login to your TimeTrex account. - Open Google Sheets and create a new sheet.
- Go to Tools -> Script Editor, clear out any default code that you may see then paste the custom script copied from step #2.
- Click File -> Save, enter a new project name if asked.
- Go back to your new spreadsheet and click on cell A1, then enter the following line. Be sure to replace the variables like <URL to TimeTrex>, <username>, <password> and <saved report name> with your specific information.
For example:Code: Select all
=ImportJSONBasicAuth("<URL to TimeTrex>/api/report/api.php?format=json&name=<saved report name>", "<username>", "<password>")
The data from the report should then appear on the screen.Code: Select all
=ImportJSONBasicAuth("https://demo.timetrex.com/api/report/api.php?format=json&name=MyReportForGoogleSheets", "demoadmin1", "demo")