Giter Club home page Giter Club logo

Comments (3)

tdpauw avatar tdpauw commented on May 18, 2024

Hi @smartphreak,
Sorry for the delay.

This google sheet makes use of the Detailed Report API from Toggl. From the documentation I understand the report returns all time entries for all users. Each time entry contains the user id and the full name of the user. This is the same API used by the Toggl user interface Reports > Detailed.

So if you want to have the user information you need to modify the data structure that is created inside the fetchTimesheet() fuction inside the Code.gs file.
This function creates a timesheet hash (dictionary):

timesheet = {
  date1: {
      client1: duration_for_date1,
      client2: duration_for_date2,
      ...
  },
  date2: {
  },
  ...
}

timesheet contains all aggregated time entries per client per day for 1 month.
Every date## property of timesheet represents a day of the month. And contains the time spent per client.
Every client## property of a date## contains the time spent for that client during the day represented by date##.
This timesheet data structure is used to populate a sheet inside the Google Sheet spreadsheet. Which is handled by the createTimesheet() function inside the Code.gs file.
As I am the only person using that workspace, this data structure only represents the data for 1 user.

To create a timesheet per user, you will probably need to create a data structure that could look as follows:

timesheets = {
  uid1: {
     name: 'full name'
     timesheet: {
        date1 : {
             ...
        },
       date2 : { ... },
       ...
     },
   uid2: { ... },
   ...
  }
}

Does this answer your question ?

Now I have to say that looking back at the code, I could have created a simpler data structure based on arrays:

timesheets = [
   {
     uid: 1,
     user: 'John Doe',
     timesheet: [
        {
          clients: [
             {
               name: 'client1',
               duration: 5236
              },
             {
               name: 'client2',
               duration: 5236
              },
              ....
          ]
        },
        { ... },
        ...
     ]
   },
   {
     uid: 2,
     user: 'Jane Doe',
     timesheet: [
        {...}
     ]
   },
  ...
]

from toggl-google-sheet.

kuttnerd avatar kuttnerd commented on May 18, 2024

cheers @smartphreak
just came over your question and this repo from @Voronenko may also be helpful for you, as i think, that it does the job you need: https://github.com/Voronenko/toggl_invoice
Best regards

from toggl-google-sheet.

tdpauw avatar tdpauw commented on May 18, 2024

Hi @smartphreak what do you mean by all the time data per user?
Do you mean all the time data aggregated per user per day?

Like ...

Date User Time
2022-01-05 user1 6:51
2022-01-05 user2 5:12
2022-01-05 user3 8:03
2022-01-06 user1 2:36
2022-01-06 user3 4:21

from toggl-google-sheet.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.