Strike-through text

How would one go with strike-through of text/numbers?
I have formatted it in Google Sheet, but it is not reflected in Glideapp.

To have formatted text, you can use Rich Text component.

Strikethrough uses two tildes. ~~Scratch this.~~

Scratch this.

Based on https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet

Yes, but my Google Sheet cell contains the strikethrough, and I want to show that in Glidapp.
Not all cells in Google Sheet are strikethrough on that component, so I can’t use a general markup like you showed here.

Glide apps do not inherit this kind of formatting from your sheet.

I did a little hacking and came up with a function that may help you. It is a custom function so unfortunately won’t work with arrayformulas (at least I couldn’t get it to work with one). Also note Markdown does not support underline because of confusion with hyperlinks I’ve heard. One other caveat to keep in mind is that the markdown function will not fire, and change the resultant markdown text, unless the actual text in the feeder field is changed in some way.

I honestly don’t know how beneficial this would be in the long run but for me it was worth the mental exercise in creating it.

function Convert2Markdown(row, col) {
  var ss = SpreadsheetApp.getActiveSpreadsheet()
  var sheet = ss.getActiveSheet();
  var cell = sheet.getRange(row, col);
  var markdown = cell.getValue();
  
  if (cell.getTextStyle().isItalic()) {markdown = "*" + markdown+ "*";}
  if (cell.getTextStyle().isBold()) {markdown = "**" + markdown+ "**";}
  if (cell.getTextStyle().isStrikethrough()) {markdown = "~~" + markdown+ "~~";}
  //if (cell.getTextStyle().isUnderline()) {markdown = "" + markdown+ "";} // note underline not supported in Markdown
  
  return markdown;  
}

Here is the result:


2 Likes