I need to use custom number formatting or something similar that will create real blank spaces, NOT just make it simply appear differently in the Excel cells. This is because I am actually using a library that implements Excel functionality called SpreadsheetGear and my ultimate output is a string.

This is what I want:

When a number is 6 digits or less, I would like it to have formats like this:

```
$ xxx,xxx
$ xx,xxx
$ x,xxx
$ xxx
$ xx
$ x
```

As shown above, there will be 2 blank spaces between the "$" and the first digit for a 6 digit number, 3 blank spaces between the "$" and the first digit for a 5 digit number, etc.

In other words, the length of the characters of the number will always be the same for number with digits 6 or less.

For numbers with more than 6 digits, just normal number formatting with commas.

Google Sheets, there is a custom formatting syntax that converts leading zero to space:? A digit in the number. An insignificant 0 will appear as a space in the results.For example,`'??0.00%`

would show`' 4.50%`

(two spaces before`4`

),`' 45.00%`

and`'100.00%`

(ignore the quote`'`

mark). – ADTC Sep 14 '17 at 6:52