← Back

Connect Excel to Redshift

2024-01-10 // Nick End, Founder

In the dynamic landscape of data analysis, connecting Excel to AWS Redshift opens up a realm of analytics capabilities. This blog post will demonstrate the different ways to make this connection. Whether you're dealing with big data with millions of rows or seeking to enhance your data analysis capabilities, this guide has you covered. Integrating Excel with Redshift is a pivotal step for data analysts and professionals. This connection allows for the seamless transfer of live data between the Excel spreadsheet and the Redshift database, enabling real-time analysis and modeling. For step-by-step instructions for each option, continue reading or jump to specific sections with the table of contents below.

  1. Power Query
  2. Power Pivot
  3. Microsoft Query
  4. Open CSV

What is Redshift?

Redshift is a powerful cloud data warehouse service provided by Amazon Web Services (AWS). Redshift facilitates the analysis of large (up to petabyte-scale) datasets. Redshift is a fully managed service that offers massive parallel processing and highly performant near real-time analytics. Visit the AWS website for more details about Redshift. Redshift is based on an older version of PostgreSQL and best suited for analytics workloads. It can connect to most applications via JDBC and ODBC connections is reported as the most commonly deployed cloud data warehouse.

The Advantages of connecting Redshift to Excel

Connecting Redshift to Excel offers several benefits, enhancing data analysis capabilities and streamlining workflows. Here are some key advantages:

Real-time Data Analysis:

By connecting Redshift to Excel, you enable real-time data analysis. This means that any changes or updates in the Redshift database are reflected immediately in your Excel spreadsheet, allowing for up-to-the-minute insights.

Live Models and Dashboards:

The integration facilitates the creation of live models and dashboards directly within Excel. You can build dynamic models that automatically update as new data is added to Redshift, providing a dynamic and interactive reporting environment.

Seamless Data Transfer:

Connecting Redshift to Excel streamlines the process of transferring data between the two platforms. This efficiency is particularly valuable when dealing with large datasets, as it eliminates the need for manual data exports and imports.

Enhanced Data Visualization:

Excel's robust visualization capabilities can be leveraged with Redshift data. You can create charts, graphs, and other visual representations of your data within Excel, making it easier to interpret and communicate insights.

Improved Collaboration:

Collaborating on data analysis becomes more effective when using Excel and Redshift together. Multiple users can access and work on the same dataset simultaneously, fostering teamwork and increasing overall productivity.

Familiar Interface:

Excel provides a user-friendly interface that is familiar to many professionals. Connecting Redshift to Excel allows users in operations, marketing, finance, and business intelligence to leverage the power of a sophisticated data warehouse without the need for extensive training in complex tools.

Flexibility in Analysis:

Excel's versatile features empower users to perform various analyses on Redshift data, from basic calculations to advanced statistical modeling. This flexibility ensures that analysts can tailor their approach to the specific requirements of their analysis.

Audit and Documentation:

The connection between Redshift and Excel enables easier tracking and documentation of data changes and analysis steps. This is crucial for maintaining an audit trail and ensuring transparency in data-related processes.

Reduced Latency in Decision-Making:

With real-time data access, decision-makers can access the most current information quickly. This reduction in latency can be crucial for making informed decisions promptly in dynamic business environments.

Cost-Efficient Analysis:

Leveraging Excel's capabilities in conjunction with Redshift can be a cost-efficient solution, especially for organizations that already have Excel as a standard tool. It eliminates the need for additional software investments for certain types of data analysis tasks.

In summary, connecting Redshift to Excel enhances the agility and efficiency of data analysis, offering real-time insights, collaboration opportunities, and a familiar interface for users.

Disadvantages when connecting Redshift to Excel

Before embarking on the connection journey, it's essential to be aware of potential draw-backs of connecting Excel to Redshift. This section will address factors such as data set size, performance limitations of Excel, sharing challenges, and the complexities involved in connecting Excel to Redshift.

Data Set Size

While Microsoft Excel is a great tool it cannot easily support large data sets. Microsoft Excel will often slow down or crash as data set sizes reach tens or hundreds of thousands rows Excel has a 1,048,576 row limit, which we've written about here. It is common for data sets stored in Redshift to be quite large. To import data from Redshift to Microsoft Excel, the Redshift query will need to trim the data down to a size Microsoft Excel can manage. There are options within Microsoft Excel, like data model and power query, to enable work with large data sets but they don't allow users to see all the data or use the same spreadsheet flexibility Excel supports with smaller data sets. If you are working with a large data set or the load time is too slow, consider using a more powerful spreadsheet.

Sharing

Microsoft Excel is offered in two versions, desktop and Excel 365. Desktop Excel is the traditional version everyone thinks of. The program runs on local computers and is fast and performant. Desktop Excel is difficult to share due to the fact that it runs on users' local computers. It is common for teams to email around multiple different versions creating static one off analyses that need to be updated, versioned, or can get out of sync if two users make updates to the same version. Companies often rely on cloud storage repositories like Sharepoint to manage all the files with checkout and check-in logic that preserve spreadsheet integrity. Excel 365 is the new version of Excel that makes sharing easy, though it is not commonly used for big models or data analysis because it is slower than desktop Excel.

Complexity

Connecting data sources to Microsoft Excel is not as easy and intuitive as one might think. There are often complications that can be hard to resolve. The information below does its best to help prevent errors that will inevitably occur and there is plenty of content online to help resolve each one.

4 Ways to connect Excel to Redshift (not sure if all these methods are valid.)

Delve into four effective methods to establish connection between Excel and Redshift. Each method will be briefly summarized, providing an overview of the options available. Before starting the first 3 methods, you will need to download and install the Redshift ODBC driver using the instructions below.

Download and install the Redshift ODBC driver

  1. To start, download the AWS Redshift ODBC driver. 2. Find the file on your computer and open it (double-click). Follow the installation instructions to install the Redshift ODBC driver. Redshift ODBC Driver Install 1 Redshift ODBC Driver Install 2
  2. Once the driver is installed go to the start menu and search for ODBC Data Sources.
  3. In the ODBC driver menu select the 'driver' tab and ensure you see Amazon Redshift ODBC Driver (x64) in the list. ODBC data sources driver menu
  4. Next, select the System DSN tab, choose Add.
  5. Select Amazon Redshift ODBC Driver (x64) and then select Finish. The Amazon Redshift ODBC Driver DSN Setup will open. Redshift odbc driver credentials
  6. Enter your Redshift database credentials and connection strings. AWS provides details on connection settings. Once all strings are entered, click Test and if the test is successful, select Ok in both the credentials window and ODBC driver window. Your ODBC driver is now set up. If the test is not successful, make sure all entered credentials are correct or check with your database administrator.

Power Query

Connecting Redshift to Excel using Power Query is a straightforward process. Power Query allows you to import and transform data from various sources, including Redshift. Here's a step-by-step guide:

  1. Open Excel: Launch Microsoft Excel on your computer.
  2. Data Tab: Navigate to the "Data" tab on the Excel ribbon.
  3. Get Data: Click on "Get Data" or "Get & Transform Data" (depending on your Excel version).
  4. From Other Sources: Choose "From Other Sources" and then select "ODBC." Redshift Excel get data from ODBC
  5. Select the ODBC driver you installed earlier and click ok. You can also write a query in the query editor in the advanced section to further specify the data you want to import. Redshift ODBC driver selection
  6. Enter Connection Details: Enter the connection details for your Redshift database, including Server, Database, Username, and Password. These credentials will be saved so you don't have to enter them a second time. Click "OK" to establish the connection.
  7. Navigator: After establishing the connection, you'll see the Navigator window. Select the tables or views you want to import into Excel and click "Load" or "Transform Data."
  8. Query Editor: The data will be loaded into the Power Query Editor, where you can perform transformations if needed. You can filter, reshape, or combine data before loading it into Excel. Power Query Editor
  9. Load Data into Excel: Once you're satisfied with the data transformations, click "Close & Load" to load the data into an Excel worksheet. Note If your data set is large, it will take a long time to load into Desktop Excel or Excel 365. The issue is Redshift is a hosted data source so the data must travel from the internet to your computer and then be loaded by Excel, which is limited to the memory and compute resources of your laptop. power query imported data
  10. Refresh Data: The data in Excel is not static; it's a live connection to your Redshift database. To refresh the data with the latest information, right-click on any cell in the imported data range and choose "Refresh" or use the "Refresh All" option.

Congratulations! You've successfully connected Redshift to Excel using Power Query. This method provides a dynamic link between your Redshift data and Excel, ensuring that any changes in the database are reflected in your spreadsheet in real-time.

Power Pivot

Connecting Redshift to Excel using Power Pivot allows you to create powerful data models and perform advanced analyses. Here's a step-by-step guide:

  1. Open Excel: Launch Microsoft Excel on your computer.

  2. Power Pivot Tab: Go to the "Power Pivot" tab on the Excel ribbon. If you don't see this tab, you may need to enable the Power Pivot add-in. To enable Power Pivot:

  • Click on "File."
  • Click on "Options."
  • In the Excel Options dialog box, go to "Add-ins."
  • In the Manage box, click "COM Add-ins" and then click "Go."
  • Check the "Microsoft Office Power Pivot" box and click "OK."
  1. Power Pivot Window: In the Power Pivot tab, click on Data model This will open a new window specifically for Power Pivot. Data model power pivot window

  2. Get External Data: In the Power Pivot window, click on "Get External Data" and choose "From Other Sources."

  3. ODBC Connection: Select "ODBC" as the data source type. data model odbc

  4. ODBC Connection Manager: In the ODBC Connection Manager, choose "Machine Data Source" and select the Redshift ODBC driver you installed earlier.

  5. Enter Connection Details: Enter the connection details for your Redshift database, including Server, Database, Username, and Password. Click "OK" to establish the connection.

  6. Select Tables and Views: After connecting, select the tables or views you want to import into Power Pivot. Click "Next" to proceed.

  7. Choose Data Import Options: Configure data import options as needed. You can choose to import data into the Power Pivot data model or create a linked table.

  8. Finish Import: Click "Finish" to complete the import process. The selected data will be loaded into the Power Pivot window.

  9. Create Relationships: If your dataset involves multiple tables, create relationships between them in the Power Pivot window. This step is crucial for building effective data models.

  10. Close and Apply: Once you've configured relationships and made any necessary adjustments, click "Close & Apply" to load the data into the Excel workbook.

  11. Build PivotTables and PivotCharts:

  • Return to the Excel worksheet, and you can now build PivotTables and PivotCharts based on the data imported from Redshift using Power Pivot.
  • Remember that Power Pivot provides a dynamic connection to your Redshift data, allowing you to create sophisticated data models and conduct in-depth analyses directly within Excel. Refresh the data to keep it up-to-date with changes in your Redshift database.

Microsoft Query

  1. Launch Microsoft Excel on your computer.
  2. Go to the "Data" tab on the Excel ribbon.
  3. Click on "Get Data" or "Get & Transform Data" (depending on your Excel version).
  4. Choose "From Other Sources" and then select "From Microsoft Query."
  5. In the Choose Data Source dialog, select "ODBC DSN" and choose the Redshift ODBC DSN you configured earlier. The Query Wizard will open. Click "OK" to proceed.
  6. In the Query Wizard, select the Redshift tables or views you want to import into Excel. Click "Next" to continue.
  • (Optional) You can specify criteria for data retrieval if needed. Click "Next" when ready.
  • (Optional) If desired, you can specify a sort order for the data. Click "Next" to proceed.
  • Complete the Query Wizard by clicking "Finish." You'll be prompted to choose how you want to view the data.
  • Choose whether to import the data into a table, create a PivotTable, or view the data in Microsoft Query. Make your selection and click "OK."
  • Once you've configured your query, click "Return Data to Excel." The selected data will be imported into Excel.
  • The data in Excel is not static; it's a live connection to your Redshift database. To refresh the data with the latest information, right-click on any cell in the imported data range and choose "Refresh" or use the "Refresh All" option.

Congratulations! You've successfully connected Redshift to Excel using Microsoft Query. This method allows you to create a dynamic link between your Redshift data and Excel, providing real-time access to your database.

Open CSV

Opening a CSV extract from Redshift is the simplest way to get data from a Redshift database into Excel. THe downside is this method doesn't establish a live-connection and excel may have some issues opening a big csv.

  1. Run Query: In your Redshift database tool (e.g., SQL Workbench), run a query to select the data you want to export.
SELECT * FROM your_table;
  1. Export to CSV: After running the query, export the result set to a CSV file. You can typically do this from the query tool's interface. Ensure that the CSV file contains headers.
  2. Open Excel: Launch Microsoft Excel on your computer.
  3. Data Tab: Go to the "Data" tab on the Excel ribbon.
  4. Get Data: Click on "Get Data" or "Get & Transform Data" (depending on your Excel version).
  5. From Text/CSV: Choose "From Text/CSV" and select the CSV file you exported from Redshift.
  6. Text Import Wizard: The Text Import Wizard will appear. Choose "Delimited" and click "Next."
  7. Specify Delimiters: Select the delimiter used in your CSV file (e.g., comma) and click "Next."
  • Column Data Format (Optional): Adjust the column data format if needed. Click "Finish" when ready.
  1. Load Data: Choose whether to load the data into a table, create a PivotTable, or load the data directly to a worksheet. Make your selection and click "OK."
  2. Refresh Data: The data in Excel is static unless you explicitly refresh it. If you need the latest data, right-click on any cell in the imported data range and choose "Refresh" or use the "Refresh All" option.

By exporting data from Redshift to a CSV file and then importing that file into Excel, you establish a simple yet effective connection. Keep in mind that this method is suitable for scenarios where you don't need real-time updates and can periodically refresh the data manually.

Conclusion

In conclusion, there are a few different ways to connect a Redshift database to your Excel workbook. All of them enable working with Redshift data in a user-friendly spreadsheet interface, which is great for users who don't know how to write code or use complicated BI tools. It's also important to remember that excel is slow when working with big data sets, like those that are commonly stored in Redshift. Excel also won't show your entire data set if it is over the Excel row limit. If you would prefer to work in a spreadsheet but have a big data set, consider using Row Zero, a spreadsheet that works like Excel but was designed for big data. You can find instructions for connecting Row Zero to Redshift here.

FAQs