But, wouldn’t it introduce some bias because there may have been periods of time with no sales, maybe due to high prices?
This by itself does not introduce bias. If at some price sales are zero then that is relevant information. You could investigate whether this is due to seasonality and control for that (e.g. sales of ice cream). However, note estimating this model with simple regression will for sure result in biased results that do not reflect true elasticity at all. Hence if you are just estimating this equation you are pretty much just wasting your time if you actually worry about having biased estimates. If you do it just to learn programming its ok but if you actually need to know elasticity for some decision making then this will not give you unbiased estimates.
Should I preprocess the data differently, perhaps by grouping sales over fixed time intervals and calculating average prices?
If you will run the regression on averages you will just make estimation less precise. The precision of parametric estimators depends on how much variation there is in the data. For example in simple OLS ($y= \beta_0 + \beta_1 x + u$) precision of $\beta_1$ is given by:
$$Var(\hat{\beta}_1) = \frac{\sigma^2_u}{N \cdot Var(x)}$$
By creating averages you are artificially suppressing some of the variation in the independent variable. In addition you will end up with less observations (smaller N). Hence there will be double penalty to the precision of your estimates.
What would be the right way to do it?
It is generally impossible to estimate elasticity just from single regression like your post suggest. When you regress sales on prices you will not get unbiased estimates of elasticity regardless of the data quality.
If you want to do it right way you have to use some simultaneous equations approach that models both the demand and supply side. For example, you could use IV regression where you use firm costs as instrument for prices (justification for this comes from mark up pricing IO models). Then the IV regression would give you unbiased estimates of elasticity.