0

I have to count the spaces within in NumberFormat of each cell in column A. Here is an example NumberFormat:

"                       "@

I translated my VBA code into OfficeScripts ExcelScript (for Excel for Web) but it seems that the replace function doesn't removes the spaces:

sheet.getRange("A1").getNumberFormat().length - sheet.getRange("A1").getNumberFormat().replace(" ", "").length

Is there another option to count the spaces or did I something wrong with the replace function (other letters will be replaced correctly)

Toto
  • 89,455
  • 62
  • 89
  • 125

1 Answers1

2

It's just the JavaScript syntax and the solution is:

sheet.getRange("A1").getNumberFormat().length - sheet.getRange("A1").getNumberFormat().replace(\s/g, "").length