On 21 Dec 2021, at 15:22, Chi Ho Kwok wrote:
> Yes indeed, by implementing worksheets.ignoredErrors, but with an API nicer
> than passing an instance of IgnoredErrors.
>
> I already tell Excel that it is a text value, by calling setting cell.value
> to a str of "0123", but then whole columns get marked with a green arrow:
>
> "Number stored as text" and a helpful hint to convert it to number; an
> example: [
https://imgur.com/QcTM8hm](https://imgur.com/QcTM8hm)
>
> By serializing an <ignoredErrors><ignoredError sqref="A1:P601"
> numberStoredAsText="1"/></ignoredErrors> in the worksheet for the right
> range or the whole sheet, you prevent these green arrows from showing up.
>
> This tells Excel that we know these text looks suspeciously like a number
> but no, leave it alone please.
Excel really is braindead in many situations like this, as this part of the specification suggests. It really should be possible to have a suitable number format and be done. This would still let Excel make suggestions when converting from text.
> While searching for references, I noticed that the same feature request was
> filed and implemented in xlsxwriter
>
> @ [
https://github.com/jmcnamara/XlsxWriter/issues/678](https://github.com/jmcnamara/XlsxWriter/issues/678); yup, same use case,
>
> long numbers that are identifiers get butchered in Excel if aren't careful
> and you don't want the green arrows.
>
> Do you have a complete pull request (different modes, tests?) that I can
> use as a reference and a starting point?
Fortunately, the Serialisable stuff is dead easy to write tests for.
Otherwise you might want to look at 409, but it should be fairly straightforward. Base your work on the 3.1 branch and we can discuss details as you go.