Forecast a Time Series from CSV
Operator: Abdulla Al Fahad. How tools are built and checked
A forecast is only as good as the choice of method, and the usual spreadsheet shortcut hides that choice. This page takes a column of dates and a column of numbers, fits eight different forecasting models, and then does the thing that matters most: it hides the last stretch of your own history, asks each model to predict it, and shows how far off each one was. You see which method would have worked on your data before you rely on it for the months ahead.
The models run from the simple (a straight trend line, a flat moving average) up to the two Holt-Winters forms that carry a trend and a repeating seasonal pattern at the same time. Whichever you pick is drawn as a chart with a shaded prediction range and written out as a table you can download. The file is read in this browser tab; nothing is sent anywhere.
Key features
- Eight models: linear trend, moving average, simple exponential smoothing, Holt linear trend, damped trend, seasonal naive, Holt-Winters additive and Holt-Winters multiplicative
- Backtest on a hidden holdout with MAE, RMSE, MAPE and sMAPE side by side, and the best model marked by the metric you choose
- Season length detected from the frequency (7 daily, 52 weekly, 12 monthly, 4 quarterly) or set by hand from 2 to 366
- Prediction ranges at 80, 90 or 95 percent that widen with the forecast distance
- Chart with actual, backtest and forecast lines plus the range, readable by pointer or arrow keys, and a paged table of every forecast period
- CSV download with a type column, and an XLSX with Forecast, Backtest and Notes sheets
- A cancel button for long fits
Frequencies, gaps, the eight models and the prediction range
One column holds dates and another holds numbers; the page guesses both from a CSV, TSV, TXT or XLSX file and lets you change them. Dates can be 2025-03-31 (with an optional time, which is ignored), 3/31/2025 or 31/3/2025, 31 Mar 2025, Mar 31, 2025, 2025-03, Mar 2025, 2025-Q1 or a bare year such as 2025; Excel serial numbers are read as dates when you pick that column yourself, and the automatic guess accepts them when the column name mentions date, time or day. A slash date such as 03/04/2025 is read month first unless another value in the column, like 25/03/2025, shows the day comes first; when nothing settles it the page says so.
The series must have at least 8 periods after grouping and no more than 20,000. A row whose date cannot be read, or whose value is blank or not a number, is skipped and counted on the page; a skipped value leaves its period empty unless another row falls in the same period.
Frequency is detected by trying daily, weekly, monthly, quarterly and yearly in that order and taking the first where the typical step between occupied periods is exactly one period and at least 60 percent of steps are one. Dates that fit none of them stop the run with a request to choose a frequency by hand, which then groups the rows into those periods. Weekly periods are anchored on the weekday most of the dates share. For monthly, quarterly and yearly data the forecast dates reuse the most common day of the month, or the last day of the month when at least half the dates were month-ends, using calendar arithmetic so 31 January is followed by 28 or 29 February and then 31 March rather than drifting by 30-day steps.
More than one row in a period is added up or averaged, your choice, which is also how daily rows become monthly ones. Periods with no row at all can be filled with a straight line between their neighbours, filled with zero, or refused with an error that names the first missing date. Filled periods are counted on the page, flagged as a warning when they make up more than a quarter of the series, and marked in the CSV note column.
How it works
Each smoothing model is fitted by choosing its smoothing weights (alpha for the level, beta for the trend, gamma for the season, phi for damping) to make the one-step-ahead squared errors as small as possible. A coarse grid of five values per weight finds a good starting corner, then a Nelder-Mead search polishes it, with the weights held between 0.01 and 0.99 (phi between 0.8 and 0.98). The search has no random element, so the same file always gives the same weights.
Holt-Winters starts from the first two seasons: the average of season one gives the starting level, the gap between the season-two and season-one averages divided by the season length gives the starting trend, and each period of season one, compared with that trend line, gives a starting seasonal value. The additive form adds the seasonal value to the trend; the multiplicative form multiplies by it, which suits swings that grow with the level. A model that needs two full seasons is reported as unavailable, with the reason, when the series is shorter, and the multiplicative form refuses series that contain zero or negative values.
The holdout defaults to one season, capped at a fifth of the series and never below 2 periods; when the series is long enough, the holdout is shortened if necessary so two full seasons stay in the training part and the Holt-Winters models can still be scored. Every model is fitted to the training part, predicts the holdout, and is scored with MAE, RMSE, MAPE (zero actuals are left out and counted) and sMAPE. Then each model is fitted again on all the data to produce the real forecast, so the backtest tells you how the method behaves but the forecast uses every observation.
Prediction ranges come from the model's own one-step errors on your data. The linear trend uses the classical t-based interval for a new observation. Exponential smoothing, Holt, damped and Holt-Winters models widen the error by the square root of one plus the sum of squared forecast weights, which grows with distance. The moving average keeps a constant width and the seasonal naive range grows with each full season ahead. For the multiplicative form the width is also scaled by the forecast level. These are approximations, not guarantees.
Common use cases
- Planning next year's stock from 36 months of unit sales that rise through summer and peak in December
- Projecting weekly website sign-ups two months ahead to size a support rota
- Checking whether a finance team's monthly cash receipts follow a trend plus a quarter-end bump before building a budget on them
- Turning a daily export of orders into a monthly view (grouped by sum) and forecasting the next 6 months from that
- Testing, on your own numbers, whether a fancy seasonal model really beats a straight line before presenting either
How to use this tool
- Choose a CSV or XLSX file, paste a table, or press Use sample data for three years of monthly sales.
- Check the date column and the value column that were picked, and set the frequency to Detect from the dates unless you want rows grouped differently.
- Decide how duplicate periods are combined and how empty periods are filled, then set how many periods to forecast.
- Leave the season length and the hidden test stretch on Automatic, or set them yourself, and press Run forecast.
- Read the backtest table. The model with the lowest score on your chosen metric is already selected; pick another with its button if you prefer.
- Pick the 80, 90 or 95 percent range, look over the chart, then download the CSV or the XLSX workbook.
Example
Sample file: 36 month-end rows of units sold, January 2023 to December 2025
month_end,units_sold
2023-01-31,350
2023-02-28,347
2023-03-31,377
2023-04-30,428
...
2025-11-30,743
2025-12-31,940
Frequency: detected monthly Season: 12 Holdout: automatic (7 periods) Range: 90%Backtest on the last 7 months, then the first forecast rows
Model RMSE MAPE
Holt-Winters multiplicative 14.0 1.60%
Holt-Winters additive 22.8 2.14%
Linear trend 96.7 8.63%
Seasonal naive 123.5 16.01%
Holt linear trend 128.1 12.79%
Selected: Holt-Winters multiplicative
2026-01-31 forecast 635.0 90% range 614.3 to 655.7
2026-02-28 forecast 597.3 90% range 577.9 to 616.8
2026-03-31 forecast 700.1 90% range 677.3 to 722.9Tips for best results
- Look at the backtest table before the chart. A seasonal model that scores far better than the linear trend is telling you the seasonal pattern is real; one that only edges it out is not worth the extra complexity.
- Pick the metric to match the cost of a miss. RMSE punishes a few large misses, MAE treats every unit of error the same, and MAPE speaks in percentages but is unreliable when values are near zero.
- Set the season length yourself for unusual cycles, such as 13 for four-week retail months or 24 for hourly data with a daily pattern, as long as the series holds two full cycles.
- Use the sum option when rolling daily rows up into months for totals like sales, and the average option for rates and prices.
- Run the forecast twice with different holdout lengths. A model that is best on every holdout is a safer pick than one that wins on a single stretch.
Common pitfalls
A model can only repeat patterns present in the history. A promotion, a price change, a new competitor or a pandemic-style break is invisible to every model here, and the prediction range will not warn you.
The prediction range is an approximation built from past one-step errors. It leaves out uncertainty about the model itself and about the weights, so real misses will fall outside it more often than the label suggests, especially far ahead.
On a very smooth or noise-free series the one-step errors are almost zero, so the range collapses to a thin line. That reflects a perfect fit to the past, not a promise about the future.
Holt-Winters weights often land on the edge of their allowed range (0.01 or 0.99) when the history is short or very regular. That is a legitimate optimum on the few scored periods, not a failed search, but it also says the weights are loosely pinned down, so compare the model against the simpler ones.
Holdouts are short. Seven or twelve scored periods is a small sample, and a model can win by luck. When two scores are close, treat them as a tie and prefer the simpler model.
Filling a long gap with a straight line invents data. If more than a quarter of the periods were filled, the forecast mostly reflects the filling rule.
Parameters pinned at the edge of their range (alpha 0.01 or gamma 0.99, say) are legitimate for some series, but they can also signal that the series is too short or has structural breaks.
Common errors and how to fix them
- The dates are not evenly spaced enough to tell daily, weekly, monthly, quarterly or yearly data
- Choose a frequency by hand. Rows are then grouped into periods of that size, adding or averaging the ones that share a period.
- Only a few rows have both a readable date and a number
- The date and value columns are probably swapped or point at the wrong columns. Change them, and check that dates are in one of the formats listed above.
- Holt-Winters shows as unavailable with a note about full seasons
- The model needs two complete seasons in the part it is fitted on (24 monthly periods, or 8 quarterly ones). Use more history, shorten the season length, or choose one of the non-seasonal models.
- Multiplicative seasonality is refused because of zeros or negatives
- That form divides by the level, so every value must be above zero. Use the additive model, or remove the zero periods first if they are not real.
Best practices
- Give seasonal models at least three seasons when you can; two is the minimum for fitting but leaves little to score on.
- Compare the chosen model's forecast with last year's actuals by eye on the chart before using the numbers anywhere important.
- Keep the downloaded XLSX Notes sheet with the forecast so the model, the weights, the holdout and the range method travel with the numbers.
What the eight models assume
The linear trend fits one straight line through every period and extends it, so it ignores seasons and recent changes in direction. The moving average predicts a flat line at the mean of the last few periods, which suits a series with no trend and little season. Simple exponential smoothing also predicts a flat line but weights recent periods more heavily.
Holt adds a trend that can change slowly, and the damped version lets that trend fade over the forecast, which usually stops a rising line from running away. Seasonal naive repeats the value from one season ago, a deliberately dumb benchmark: if a fancier model cannot beat it in the backtest, it is not capturing anything real. The two Holt-Winters forms combine level, trend and a repeating seasonal pattern, additive when the swing is a steady number of units, multiplicative when it is a steady percentage of the level.
- Flat forecasts (moving average, exponential smoothing) will look like a horizontal line on trending data, which is the correct output of those models
- Seasonal naive carries last season's noise forward along with its pattern
- Multiplicative Holt-Winters needs every value above zero
Reading the interval
A 90 percent range here means that, if the future errors behaved like the one-step errors your data has already shown, about nine in ten actual values would land inside. The widening with distance reflects that each step compounds earlier uncertainty. In a seeded check run while building this page, 90 percent ranges from the additive Holt-Winters model on 40 synthetic noisy seasonal series, each forecast 12 periods ahead, covered 91 percent of the 480 held-back points. Real data with breaks and shocks will do worse than synthetic data, which is why the page repeats that these are approximations.
Frequently asked questions
Does my file leave my computer?
No. The file is read and every model is fitted inside this browser tab. Nothing is uploaded, and closing the tab discards the data.
Why is the best model not the one I expected?
The best model is simply the one with the lowest error on the hidden periods. Change the metric, change the holdout length, or choose a model yourself with the button in its row; the chart and table follow your choice.
How is this different from the Excel forecast sheet?
The sheet fits one seasonal model and shows its range. This page fits eight, scores them on data they were not fitted to, and lets you pick, and the XLSX records which model and weights produced the numbers.
Can it forecast several products at once?
Not in one run. It forecasts one value column against one date column. Run it once per product, or filter the file to one product first.
What happens to rows with a missing value?
They are skipped and counted. Their period becomes a gap unless another row falls in it, and gaps are filled by the rule you chose (straight line, zero, or stop with an error).