Home > OS >  Power Automate | How to extract hyperlink from Excel formula?
Power Automate | How to extract hyperlink from Excel formula?

Time:12-25

Ho to extract hyperlink address from Excel worksheet using Power Automate? enter image description here

CodePudding user response:

Use OfficeScripts to achieve it.

Go to Excel and the Automate tab in the ribbon. From here, you can create a script that will take a cell reference as a parameter. With that cell reference, read the cell and split up the formula.

Call it "Get Hyperlink From Formula" (or whatever) and copy this formula in ...

function main(workbook: ExcelScript.Workbook, fqCellAddress: string)
{
  const worksheetName = fqCellAddress.split("!")[0];
  const cellAddress = fqCellAddress.split("!")[1];

  let cell = workbook.getWorksheet(worksheetName).getRange(cellAddress);
  let hyperlinkFormula = cell.getFormulaLocal();
  let hyperlink = hyperlinkFormula.split(",")[0].split("(")[1];

  return hyperlink;
}

From there, call it from the PowerAutomate action as shown below.

Office Script

Then in your flow, you'll see the output which you can then work with as required.

Action

Action

Result

Result

  • Related