Volta is given credit for the battery, which we call the Voltaic Pile. But he gave credit to:
"In announcing his discovery of his voltaic pile, Volta paid tribute to the influences of William Nicholson, Tiberius Cavallo, and Abraham Bennet.[See source]"
I'm sure these gents of the early 1800s were also aware of electricity in some form.
Of course static electricity was well known by then as some used it as a show of "magic." That is, they knew the effects: sparks and attraction, but they really didn't know the science. Here's a brief history:
As far back as 2000 BC, fishermen were aware of shocks from certain kinds of fish. These were, of course, several varieties of electric eel. [See source.]
"Possibly the earliest and nearest approach to the discovery of the identity of lightning, and electricity from any other source, is to be attributed to the Arabs, who before the 15th century had the Arabic word for lightning (raad) applied to the electric ray.[See source]" NOTE Long before the Ben Franklin experiments.
"Electricity would remain little more than an intellectual curiosity for millennia until 1600, when the English scientist William Gilbert made a careful study of electricity and magnetism, distinguishing the lodestone effect from static electricity produced by rubbing amber.[6] He coined the New Latin word electricus ("of amber" or "like amber", from ήλεκτρον [elektron], the Greek word for "amber") to refer to the property of attracting small objects after being rubbed.[See source]" NOTE the origin of the word electricity.
The late 1800s saw a remarkable advance in understanding and using electricity. Some notables in this era were Nikola Tesla, Galileo Ferraris, Oliver Heaviside, Thomas Edison, Ottó Bláthy, Ányos Jedlik, Sir Charles Parsons, Joseph Swan, George Westinghouse, Ernst Werner von Siemens, Alexander Graham Bell and Lord Kelvin. [See source.]
As you can see, electricity wasn't "discovered" all at once. Little bits of it, some properties, were discovered over a long period of time and by a lot of people.