Search Unity

Question Getting the text formatting from google sheets

Discussion in 'Localization Tools' started by toriakai, Mar 21, 2023.

  1. toriakai

    toriakai

    Joined:
    Dec 15, 2016
    Posts:
    4
    Hello,

    I'm trying to extend the Google Sheets integration to get the text formatting (bold, italic, color, ..). To to that I changed the request.Fileds in the GoogleSheets.cs to include "sheets.data.rowData.values.textFormatRuns" and then ready it from the the CellData TextFormatRuns filed. The problem is that this value is always null, even for cells that do contain formatting.

    Am I missing something? Is there a better / simpler way to achieve that?
     
  2. toriakai

    toriakai

    Joined:
    Dec 15, 2016
    Posts:
    4
    Ok I got it, it was null because my test set were only one formatting per cell, thus not generating any format runs by the server (contrary to the .getRuns() in the google sheets app script who will generate a run with only one format). The data I was looking for are deserialized in CellData.EffectiveFormat.TextFormat.

    Note that I had to add "sheets.data.rowData.values.effectiveFormat" to the request fields in addition to "sheets.data.rowData.values.textFormatRuns".

    I guess I'll leave this here in case someone runs into a similar question.
     
    karl_jones likes this.