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:


5 Likes

hi there
there is 'original price" and discount price" column in my app .i want to show a on strike ‘original price’ of each product. is this possible?
this was mentioned above Scratch this. but when i used it and entered the original price ,it is showing the same price for all products. :confused:

I’m not sure I follow your problem. Did you type a number into a new rich text component instead of pointing it to a column in your data? If I’m understanding correctly, that would explain why all products have the same original price.

I think your best bet would be to use a rich text component, so you could apply the strike through markdown by using a template column and wrapping the price with the strikethrough markdown symbols.

An alternative would be to just type the value with the strikethrough on a word processor or different website and copy and paste that value into your data. Then it would work in any component and you wouldn’t need to wrap in is markdown.

2 Likes

i see,got it now thank you very much a lot for helping

1 Like

I can’t get to work.
I have a list of names in my spreadsheet.
I need to strikethrough on some.
I’ve tried 2 tildes either side of text eg
86. any name

and that is exactly how it appears in glide. It doesn’t show as strikethrough
Thank you, Dance

In the previous email I put the 2 tildes either side of 86. any name and when I hit reply I can see it did what it was supposed to do.
But when I do the same in my spreadsheet, it simply puts the 2 tildes either side of the name in Glide.
I’m using inline format for my list in glide.
Thanks

That will only work if you are displaying the value in a Rich Text component.

Thanks Darren, I suspected as much. So no way to do it with my scenario :frowning:

The only way would be with CSS, assuming your list is on a Details screen.
If you’re using a List Layout, then no - not possible.

It’s a list layout. I have these columns for my competition.
Section number and name (grouped by this column)
Competitor number and name
Level
It’s a large list (877 rows!)
Can’t think of any other way to lay it out.
JD

2 Likes