Row Zero is the best spreadsheet for big data. Try for free →

Run ARIMA in a Spreadsheet

2025-05-28 // Tom Ward, Software and Analytics Consultant

arima model in spreadsheet The Autoregressive Integrated Moving Average (ARIMA) model is one of the most commonly used statistical models to forecast time series data. Although spreadsheets are often the tool of choice for working with time series data like sales data, financial data, inventory data, or website traffic data, very few spreadsheets natively support forecasting with ARIMA models. Due to their complexity, ARIMA models are usually created in R, Python, or advanced statistics software.

Row Zero is an enterprise-grade spreadsheet that you can directly connect to a database or data warehouse, making it a great choice for working with time series data. Since Row Zero workbooks give you access to a native Python environment alongside your spreadsheet, you can leverage the Python data ecosystem to build powerful forecasting models like ARIMA in a spreadsheet environment.

If you’re interested in seeing a working example of an ARIMA model in a Row Zero workbook, jump ahead to the Row Zero template. The general ideas used in this blog post and template are also extensible to most models in the Python ecosystem. You can use Row Zero to work with very large datasets in a spreadsheet environment, while creating powerful models in Python that can interact with your spreadsheet data.


Table of Contents


What is ARIMA?

The ARIMA model is a widely used statistical model for analyzing and forecasting time series data. ARIMA stands for Autoregressive Integrated Moving Average. The ARIMA model is really a combination of a few different parts for forecasting time series data:

  1. The Autoregressive (AR) part uses previous values of the same variable to predict a current value. The variable is “regressed” on previous values of itself. This part of the model reflects the influence that previous values have on prediction.
  2. The Integrated (I) part replaces values in the time series with the difference between each value and previous values (this is usually called “differencing” or “seasonal differencing” when it’s periodic). This is a key part of the model that makes it usable on “non-stationary” data, like data with trends and seasonality.
  3. The Moving Average (MA) part models the error term as a linear combination of previous error terms. This part of the model helps smooth out short-term fluctuations.

Common use cases for ARIMA

ARIMA models are good for predicting future points in a time series. ARIMA models are particularly effective for forecasting time series because they are designed to handle non-stationarity like trending and seasonality that’s present in most real world time series data.

ARIMA models are used for sales forecasting, demand planning, supply chain planning, and other general demand pattern prediction. ARIMA models are also used heavily in finance for things like stock price prediction, interest rate forecasting, exchange rate forecasting, and volatility estimation.

Building an ARIMA model in Row Zero

Row Zero's built-in Python environment makes it easy to forecast with ARIMA models in a spreadsheet. Row Zero also connects directly to your data warehouse and has power to handle very large datasets, so you can work with active time series datasets.

Here are the steps for building an ARIMA model in Row Zero. Check out the Row Zero template below for a working example and the Python documentation for details on how to use Row Zero’s built-in Python code window.

  1. Import your time series data into a Row Zero workbook as a data table. You can connect directly to data sources or import various file formats (CSV, Parquet, JSONL, etc.)
  2. Open up the code window.
  3. Add any Python packages you’ll need. In the example template below, I used pandas and the ARIMA and adfuller functions from statsmodel.
  4. It’s good practice to test your time series for stationarity using the Augmented Dickey-Fuller Test. If your data isn’t stationary, you can use differencing. You can do this using the adfuller function in the statsmodels Python package and display the results of the test directly in the spreadsheet by calling your Python function from the spreadsheet. arima stationarity test in spreadsheet
  5. You can then use the ARIMA function in the statsmodels Python package to build your ARIMA model and forecast results. arima forecast in spreadsheet

See an example ARIMA model in a Row Zero template

Here is a working example of an ARIMA model in a Row Zero workbook. I used a dataset of daily total female births in California in 1959, which is a common sample time series dataset. The workbook contains 3 tabs:

  1. Raw Data - your raw data would likely come from a .csv file or a database or data warehouse you connect your workbook to. I’m just including raw data in a tabular format on a separate tab here.
  2. Data Table - this is the raw data converted to a data table. Note, you can also import files as data tables directly and data imported from connected data sources are imported as data tables.
  3. Data + Forecast - this is the results of the Augmented Dickey-Fuller test, displayed as a data table and the original dataset + forecast data.

arima model forecast in spreadsheet

Click the 'Code' button in the top right of the workbook to view the code window, where you can see 3 main parts of the ARIMA Python code:

  1. Imported Python packages you’ll need.
  2. A Python function for testing stationarity using the adfuller function that takes a data table as a parameter, which converts to a dataframe in the Python environment. For more information on how Row Zero maps data types from the spreadsheet to the Python environment, check out our Python documentation. This function returns the results of the test as a (Python) dataframe / (spreadsheet) data table.
  3. A Python function for building the ARIMA model and creating the forecast that again takes a data table as a parameter and returns the original data plus forecast as a dataframe / data table to the spreadsheet.

You can view the full ARIMA Python code in the Appendix or view the working ARIMA example here in a workbook.

Again, this general idea can be extended to other powerful Python models. Row Zero makes it easy to work with your data in a spreadsheet and leverage the power of the Python data ecosystem for building complex models and functions.

Can you use ARIMA in Excel?

Excel does not natively support ARIMA. There are a few workarounds that allow you to use ARIMA in Excel. There are Excel add-ins and tools, like XLSTAT or NumXL that come with extra fees and/or subscriptions that allow you to use ARIMA in Excel. Also, you can manually build an ARIMA model in Excel through a series of many steps, including creating lagged variables for the “AR” part of the model, estimating moving averages of residuals for the “MA” part, manually differencing the data for the “I” part, and using regression formulas and iterating over parameters manually. You can also create an ARIMA model in a more powerful statistical language like R or Python and then export results to Excel.

Can you use ARIMA in Google Sheets?

Google Sheets does not natively support ARIMA either. There are a few workarounds similar to those for Excel that you can use to run ARIMA in Google Sheets. There are add-ins available for purchase that will allow you to to use ARIMA in Google Sheets. You can also manually build an ARIMA model by manually creating several variables and regressions and then combining these through complex formulas. You can also use R or Python and export results of the model to Sheets.

What are the downsides of ARIMA in Excel and Google Sheets?

While it is possible to use ARIMA in Excel or Google Sheets, there are many disadvantages to the various approaches. Add-ins come at an additional cost and can be difficult to scale across many users. Manually creating and using an ARIMA model using native Excel and Sheets formulas and functionality is complex and error-prone. Using R or Python to build an ARIMA model and then exporting results to Excel or Sheets makes for a disjointed, unintegrated flow.

Additionally, Excel is limited to 1,048,576 rows and Google Sheets is limited to 10 million cells per spreadsheet. Real world time series data is often larger than these limits, making these tools impractical. If the time series data is stored in a database or data warehouse, there is the additional complexity of connecting Excel or Sheets to the data source.

Conclusion

The Autoregressive Integrated Moving Average (ARIMA) model is a common statistical model for forecasting time series data. It can be a challenge to build ARIMA forecast models in legacy spreadsheets due to their complexity and tendency to be used with large datasets. To work with ARIMA models in Excel and Google Sheets, you'll need to do some workarounds or purchase add-ons, and will be restricted to the data limits of Excel and Sheets. Row Zero is an enterprise-grade spreadsheet that is well-suited for building powerful Python models on big datasets in a spreadsheet. Row Zero has a built-in Python code window, connects directly to data sources, and supports much larger datasets. You can view a live ARIMA example in Row Zero and try Row Zero for free to get started.

View the live ARIMA example

Appendix

Below you'll find the ARIMA python code that you can copy and paste into the code window in Row Zero to create your ARIMA spreadsheet functions:

import numpy as np
import pandas as pd
from statsmodels.tsa.arima.model import ARIMA
from statsmodels.tsa.stattools import adfuller

    
def test_stationarity(df):

    result = adfuller(df["Births"])

    adf_results_df = pd.DataFrame({
    "ADF Statistic": [result[0]],
    "p-value": [result[1]],
    "Lags Used": [result[2]],
    "Observations": [result[3]],
    "1% Critical Value": [result[4]['1%']],
    "5% Critical Value": [result[4]['5%']],
    "10% Critical Value": [result[4]['10%']]
    })
    
    return(adf_results_df)

def forecast_with_arima(df):

    # Format and setup the dataframe
    df = df.to_pandas()
    df.set_index('Date', inplace=True)
    df.index = pd.date_range(start=df.index[0], periods=len(df), freq='D')

    # Build an ARIMA model
    model = ARIMA(df["Births"],order=(1,0,1))
    fitted = model.fit()
    
    # Forecast next 30 days using your fitted model and put it in a dataframe
    forecast_steps = 30
    forecast = fitted.get_forecast(steps=forecast_steps)
    forecast_mean = forecast.predicted_mean
    forecast_index = pd.date_range(start=df.index[-1] + pd.Timedelta(days=1), periods=30, freq="D")
    forecast_df = pd.DataFrame({
        "Births": forecast_mean.values,
    }, index=forecast_index)
    forecast_df["Births"] = forecast_df["Births"].round(0).astype(int)
    
    # Combine original data with forecast data
    combined_df = pd.concat([df, forecast_df])
    combined_df.index = combined_df.index.date
    combined_df.index.name = "Date"
    
    # Return the forecasted dataframe to the spreadsheet
    return(combined_df)

FAQs