Home > Software design >  ExcelJs dynamic hyperlinks not routing
ExcelJs dynamic hyperlinks not routing

Time:12-06

I created a workbook in Exceljs and added some worksheets dynamically do them. Basically I have a master worksheet that is the first thing you see when you open it up. However, I've also created player profiles for each person in my initial table. I'm trying to link them up with this piece of code.

    team.forEach((e, index) => {
      console.log(`--- Writing ${e.name} ---`)

      worksheet.addRow({
        teamName: e.teamName,
        name: e.name,
        weight: e.weight,
        wins: e.wins,
        losses: e.losses,
        profile: {
          text: 'This Profile',
          hyperlink: `${e.name}`
        }
      })

And unfortunately, this is just showing the text This Profile and it isn't able to be clicked on. Each of my worksheets are just the names of the people apart of the team. I am not sure if there is special syntax I need to add.

Here is how I am naming my workbook. I see all of the player profiles being created, just the hyperlinks aren't working.

async function writePlayerProfile(e, workbook) {
  let worksheet = workbook.addWorksheet(`${e.name}`)

CodePudding user response:

your code looks good but there is an issue in excel js maybe this will help you

hyperlink issue excel js

CodePudding user response:

I believe that your hyperlink is wrong because the data is {e.name} that doesn't seem to have valid URL format.

  • Related