title: SheetJS: transpose row values from array to object
body: <p>I am trying to create an array, where each &quot;Working Day&quot; is an object with an index and start/end date but I have no clue how to manipulate the JSON to have a specific structure.</p>
  <p>I am using the following package: <a href="https://github.com/SheetJS/sheetjs" rel="nofollow noreferrer">https://github.com/SheetJS/sheetjs</a></p>
  <p>Current code:</p>
  <pre><code>const workbook = XLSX.read(file.buffer, { type: 'buffer' });
  const worksheet = workbook.Sheets['Calendar Config'];
  const parsed = XLSX.utils.sheet_to_json(worksheet);
  </code></pre>
  <p>Current output:</p>
  <pre><code>[
    {
      'Calendar Name': 'Standard',
      'Valid From': 44197,
      'Valid To': 44561,
      'Use Holidays': 'yes',
      'Working Day': 'Monday',
      Start: 0.3333333333333333,
      End: 0.8333333333333334
    },
    {
      'Working Day': 'Tuesday',
      Start: 0.3333333333333333,
      End: 0.8333333333333334
    },
    {
      'Working Day': 'Wednesday',
      Start: 0.3333333333333333,
      End: 0.8333333333333334
    },
    {
      'Working Day': 'Thursday',
      Start: 0.3333333333333333,
      End: 0.8333333333333334
    },
    {
      'Working Day': 'Friday',
      Start: 0.3333333333333333,
      End: 0.8333333333333334
    },
    { 'Working Day': 'Saturday', Start: '-', End: '-' },
    { 'Working Day': 'Sunday', Start: '-', End: '-' }
  ]
  </code></pre>
  <p>Desired JSON:</p>
  <pre><code>{
   &quot;name&quot;: &quot;Standard&quot;,
   &quot;validFrom&quot;: &quot;2021-01-01T00:00:00.000Z&quot;,
   &quot;validTo&quot;: &quot;2021-12-31T00:00:00.000Z&quot;,
   &quot;useHolidays&quot;: true,
   &quot;workingDays&quot;: [
    {
      &quot;dayIndex&quot;: 0,
      &quot;dayStart&quot;: &quot;8:00&quot;,
      &quot;dayEnd&quot;: &quot;20:00&quot;
    },
    {
      &quot;dayIndex&quot;: 1,
      &quot;dayStart&quot;: &quot;8:00&quot;,
      &quot;dayEnd&quot;: &quot;20:00&quot;
    },
    ...
    {
      &quot;dayIndex&quot;: 6,
      &quot;dayStart&quot;: &quot;-&quot;,
      &quot;dayEnd&quot;: &quot;-&quot;
    },
   ],
   &quot;uploadedBy&quot;: &quot;foo&quot;
  }
  </code></pre>
  <p>Parsed Excel Sheet:</p>
  <p><a href="https://i.stack.imgur.com/mCxXs.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mCxXs.png" alt="excel screenshot" /></a></p>