Bold description text from Google Sheets script to Calendar

Viewed 711

I have a script to create calendar events from a Google sheet. It is working well, but I would like to bold certain text within the Calendar event description. I can't seem to find a way to do this! Any advice?

By the way, its just set up to read one line right now so that I can test it...

Here is my script:

'''
function onOpen() {
  var spreadsheet = SpreadsheetApp.getActive();
  var menuItems = [
    {name: 'Sync to Calendar', functionName: 'syncCalendar'},
   ];
  spreadsheet.addMenu('Sync to Calendar', menuItems);
}


function syncCalendar() {
  var spreadsheet = SpreadsheetApp.getActiveSheet();
  var calendarId = spreadsheet.getRange("C4").getValue();
  var eventCal = CalendarApp.getCalendarById("CALENDAR ID");
  var signups = spreadsheet.getRange("A32:U32").getValues();

    for (x=0; x<signups.length; x++) {

    var shift = signups[x];

    var buildDate = shift[0];
    var steelPO = shift[1];
    var name = shift[2];
    var size = shift[3];
    var install = shift[4];
    var fabnotes = shift[5];
    var shopnotes = shift[8];
    var buildnotes = shift[10];
    var leadbuilder = shift[11];
    var contact = shift[12];
    var location = shift[13];
    var advanced = {location:location, description:("Steel PO " + steelPO + "\n\nLead Builder: " + leadbuilder + "\n\nContact: " + contact + "\n\nBuild Notes: " + buildnotes + "\n\nShop Notes: " + shopnotes + "\n\nFab Notes: " + fabnotes)};

  eventCal.createAllDayEvent((name + " " + size + " " + install), buildDate, advanced);
}
}
1 Answers
  • You want to put the value for the description of calendar event as the bold type.
  • You want to achieve this using Google Apps Script.

If my understanding is correct, how about this answer?

Modification points:

  • For the description of calendar event, HTML tag can be used.
    • When I had retrieved the event which has the description of the bold type and the hyperlinks, I could notice that the HTML tags are used. So I could know to be able to use HTML tags for the description. But I couldn't find the official document about this. So I'm not sure whether all HTML tags can be used. I apologize for this.

Modified script:

As a test case, when steelPO of description is set as the bold type, please modify as follows.

From:
var advanced = {location:location, description:("Steel PO " + steelPO + "\n\nLead Builder: " + leadbuilder + "\n\nContact: " + contact + "\n\nBuild Notes: " + buildnotes + "\n\nShop Notes: " + shopnotes + "\n\nFab Notes: " + fabnotes)};
To:
var advanced = {location:location, description:("Steel PO <b>" + steelPO + "</b>\n\nLead Builder: " + leadbuilder + "\n\nContact: " + contact + "\n\nBuild Notes: " + buildnotes + "\n\nShop Notes: " + shopnotes + "\n\nFab Notes: " + fabnotes)};
  • HTML tag of <b> was added.

Reference:

If this was not the direction you want, I apologize.

Related