0

I have an excel sheet which contains a hyperlink. I am editing this excel sheet from R using the openxlsx package to read and edit it and to save it afterwards again.

One step involves deleting all data from a certain range:

  openxlsx::deleteData(
    wb = wb,
    sheet = sheet,
    cols = dataCols,
    rows = dataRows[1]:max_row,
    gridExpand = TRUE
  )

The problem is now, that one cell contains a hyperlink, which stays, but the text is deleted.

How can I delete all hyperlinks in the same range as well?

Konrad Rudolph
  • 530,221
  • 131
  • 937
  • 1,214
Rainer
  • 8,347
  • 1
  • 23
  • 28

1 Answers1

1

You can try to set the Hyperlink to NULL. Here is a Documentation-Article about that:

makeHyperlinkString

BlueQuote
  • 128
  • 11
  • You should rather use VBA for manipulating Excel-Files by the way. It's built into Excel by Microsoft just for the purpose of doing exactly that. With VBA things are way easier. :) – BlueQuote Mar 06 '19 at 10:16
  • Thanks BlueQuote - but I don't want to use Microsoft products for this because I want to stay in the realm of open source - but that is a different issue. And by the way: I have used VBA, and it was in no way easier. – Rainer Mar 06 '19 at 10:27
  • This sounds to much like a workaround. I will file a bug report, as the documentation to `deleteData` says that it should "Delete contents and styling from a cell." - and a hyperlink is also content. – Rainer Mar 06 '19 at 10:36