No. "Rapunzel" was collected and published by The Brothers Grimm (Jacob & Wilhelm) in Children's and Household Tales (1812, Vol. 1).
Hans Christian Andersen (Danish) wrote original literary fairy tales like The Little Mermaid, The Ugly Duckling, and The Snow Queen. The Grimms (German) collected oral folklore. Different authors, nationalities, and methods.