Thursday, July 18, 2013

Google Spreadsheet Strike through on a Cell with and without Script

Question:

How to set Strike-through like "KISHAN" in Google spreadsheet's cell. (With and Without Google Spreadsheet Script) ??

Solution:

You can set the strike-through on any cell by having focus on that cell and then go to "Format" menu > "Strikethrough".

And the short cut key for it is Alt+Shift+5


Have a look at the following screenshot:




And if you want to have a strikethrough on any text in a cell with the help of scripts, then have a look at the following code:

///////////////////////////////////////

function StrikeThrough() {
  var ss = SpreadsheetApp.getActiveSpreadsheet(); 
  var mysheet = ss.getActiveSheet();
  var cellA1 = mysheet.getRange("A1");
  cellA1.setFontLine("line-through");
}

///////////////////////////////////////


put the above code in your script editor, and now when you will run the function StrikeThrough(), Cell A1 's Text will set have a strike-through.



And If you are not much familiar with scripts then check out the following link:
http://igoogledrive.blogspot.com/2012/08/how-to-write-script-in-google.html 

I hope the above solution will help you, and if you need more help then please do comment below on this blog itself, I will try to help you out.


I also take up private and confidential projects:
If this blog post was helpful to you, and if you think you want to help me too and make my this blog survive then please donate here: http://igoogledrive.blogspot.com/2012/09/donate.html 

Thanks,

No comments:

Post a Comment