First of all, I am sorry that you are losing your grandmother. It makes for a difficult time.
Regarding your daughter, I don't think she is too young to be exposed to "death." She will see that bugs die, flowers die, etc. and if she ever sees your grandma for visits, you can't hide the fact that she died. Nor should you. You need to at least tell her in a way that she won't assume you or she or anyone else is going to die right away just because grandma did. If you are a religious person, teach her your beliefs about the afterlife.
My oldest two children are 5 and 3 and they are very comfortable with the concept. They know what funerals, caskets and cemetaries are. Because I am a Christian, they understand about heaven and the resurrection. When they ask me if I am going to die, I say "Of course, that is how we get back home to heaven. But it probably won't happen until you are so very old - probably a grandparent. Then I will go to heaven first and wait for you to come, just like I waited for you to come to me before you were born. Then when you come to heaven we can be together forever as a family with Jesus." They are fine with that because I tell them like it is a fact of life, because it is. If I would try to hide the truth or lie, they would eventually see through it and death could be a very scary thing.
Regarding the funeral, if your daughter hardly knows your grandma, she really doesn't need to attend the funeral. You can tell her that you are going to a (long, sitting quietly) meeting where everyone remembers grandma and it is a time for you to accept that she is gone. You are going to say goodbye even though she is already gone and mostly grown ups will be there. Tell her she would be happier playing with toys and being noisy.
If your daughter was very close to your grandma, she should go to at least part of the services and be well preped in advance for what she sees and hears. You may decide to have her skip the viewing or if the services will be long, skip another part. She WILL have lots of questions and that is okay. Answer them honestly with a short and simple answer she can understand. If it is hard to keep answering because you're in mourning, have your husband help you. If you are concerned about what she might say at the service, (I attended a graveside service once where a three year old kept pointing to the casket and saying "does everyone know there is a dead body in here?") explain to her that questions need to wait until the funeral is over and it is just the two of you. Or if it can't wait, she needs to whisper in your ear. If she is unable to follow those kind of instructions, it would be best not to have her come.
She is bound to notice the mourning or the crying if she attends the funeral. Tell her that even grown ups cry when they are sad and that it is okay. Everyone feels sad for a while when someone dies, but eventually the sad feelings get less and less as we keep living.
Last of all, keep your grandmother's memory alive with your daughter. My husband lost his grandfather when my two oldest children were very young. We have pictures of my kids with their great-grandpa in their room. We talk about how they used to sit on his lap when they were babies. We named our youngest after his great-grandpa and all the kids understand that. My oldest daughter had a good cry when he died and then she was fine. She likes when we talk about him and it honors his memory to do it.