One of my clients is using toggl app for time tracking. I need to build a script that…
- User
One of my clients is using toggl app for time tracking. I need to build a script that will pull employees work hours out of toggl into a Google sheet and display them in a certain format / column order. Can you help instruct me how to do that step by step? I’m not a developer but I can follow instructions.
- Assistant
I'd be happy to help you with that! Here's a step-by-step guide to pulling employee work hours from Toggl into a Google Sheet using Google Apps Script.
- User
Ok that’s a good start. How do I: 1. Select the employee I need 2. Select the date range 3. Pull the work hours in a specific format into specific columns on the sheet
- Assistant
I'm glad you found the initial instructions helpful! Here's how you can modify the script to meet your additional requirements:
- Select the employee you need:
To filter the data for a specific employee, you can add a condition inside the for loop to check if the current user matches the desired employee. Replace the for loop in the script with the following code:
- User
thank you. this is the format that i need - i need to have a total number of hours by DAY for each date in the date range can you add that please? it should be a number like 2.5 not HH:mm format
- Assistant
Sure! Here's how you can modify the script to display the total number of hours by day:
- Add a new header for the total hours by day:
javascriptvar headers = ["Employee", "Project", "Task", "Description", "Start Time", "Duration (hours)"];- Update the
rowarray to include thedurationFormattedvariable:
javascriptvar row = [ data[i].user, data[i].project, data[i].task, data[i].description, data[i].start, durationFormatted ];
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.