Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Tableau Prep Cookbook

You're reading from   Tableau Prep Cookbook Use Tableau Prep to clean, combine, and transform your data for analysis

Arrow left icon
Product type Paperback
Published in Mar 2021
Publisher Packt
ISBN-13 9781800563766
Length 288 pages
Edition 1st Edition
Tools
Arrow right icon
Author (1):
Arrow left icon
Hendrik Kleine Hendrik Kleine
Author Profile Icon Hendrik Kleine
Hendrik Kleine
Arrow right icon
View More author details
Toc

Table of Contents (11) Chapters Close

Preface 1. Chapter 1: Getting Started with Tableau Prep 2. Chapter 2: Extract and Load Processes FREE CHAPTER 3. Chapter 3: Cleaning Transformations 4. Chapter 4: Data Aggregation 5. Chapter 5: Combining Data 6. Chapter 6: Pivoting Data 7. Chapter 7: Creating Powerful Calculations 8. Chapter 8: Data Science in Tableau Prep Builder 9. Chapter 9: Creating Prep Flows in Various Business Scenarios 10. Other Books You May Enjoy

Writing data to CSV and Hyper files

In this recipe, we'll create an output to a file. There are two file outputs supported by Tableau Prep, Comma-Separated Values (.csv) files and Tableau extracts (.hyper). When you're planning to perform downstream analysis with Tableau Desktop, I recommend using Tableau extracts as they have great performance benefits. If, however, you're utilizing it for any other purposes, CSV is a great open format to utilize.

Getting ready

Follow along with the steps in this recipe by downloading the Sample Files 2.8 folder from the book's GitHub repository.

How to do it…

To follow along with the recipe, open up a new flow in Tableau Prep Builder and configure a data input connection, using the Superstore Sales.hyper sample file.

Then, follow along with these steps:

  1. Hover your mouse over the data input step in your flow and click the + icon. The context menu allows you to select a step to be added to your flow in order to build your pipeline. In this recipe, we're focusing solely on the output, so select the Output option:
    Figure 2.29 – Adding an Output step to your flow

    Figure 2.29 – Adding an Output step to your flow

  2. Tableau Prep will instantly add the Output step and select it, which brings up the bottom pane where the output configuration is visible, as well as a data preview.
  3. In the output settings, the default configuration is always File and the type is Tableau Data Extract (.hyper). We can change the output Name, which is the filename, Location, and Output type properties here. The only other available type is Comma-Separated Values (.csv). Let's change the location to the same folder as our input file:

    Figure 2.30 – File output settings

    Figure 2.30 – File output settings

    Important note

    Saving to Tableau Server: If you'd like to save a hyper extract output to Tableau Server, you can change the owutput from File to Published Data Source. This will then write the hyper file to Tableau Server. This is only possible for hyper files and not for CSV files.

  4. The only difference in settings between these two output types is the ability to append an existing file. This option is only available for Tableau data extracts and will write the data as new rows to an existing hyper file:
    Figure 2.31 – Append to table is only available for Tableau hyper extracts

    Figure 2.31 – Append to table is only available for Tableau hyper extracts

  5. We can adjust our output settings as desired. In this example, let's leave all the default settings as they are. When ready, click Run Flow to execute your flow and generate the output. When done, Tableau Prep will show a success message.
  6. Let's browse our filesystem and verify that the output has been produced:

    Figure 2.32 – The output generated by Tableau Prep

    Figure 2.32 – The output generated by Tableau Prep

  7. Anytime you've created a hyper extract, you can easily validate the extract by connecting to it in Tableau Desktop, using it as a data source:
Figure 2.33 – Using Tableau Prep hyper output as a data source in Tableau Desktop

Figure 2.33 – Using Tableau Prep hyper output as a data source in Tableau Desktop

Using the steps in this recipe, you have learned how to write data from Tableau Prep to CSV and hyper files.

How it works…

Using the Output tool, you can easily write data to CSV and hyper files for use in other analytics applications. If you save your output to Tableau Server, this is a great way to maintain those outputs.

You have been reading a chapter from
Tableau Prep Cookbook
Published in: Mar 2021
Publisher: Packt
ISBN-13: 9781800563766
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at ₹800/month. Cancel anytime