19
Opening CSV-Formatted Files Correctly in Excel Procurement Business Intelligence Service (PBIS) OSD, AT&L, DPAP Version 1.0 02/10/2017 Document Revision: V1.0 Page 1

Contents · Web viewFirst open a blank workbook in Excel. This will either open by default when launching the Excel application, or you can choose “Blank Workbook” from the template

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Contents · Web viewFirst open a blank workbook in Excel. This will either open by default when launching the Excel application, or you can choose “Blank Workbook” from the template

Opening CSV-Formatted Files Correctly in ExcelProcurement Business Intelligence Service (PBIS)

OSD, AT&L, DPAP

Version 1.0

02/10/2017

Document Revision: V1.0 Page 1

Page 2: Contents · Web viewFirst open a blank workbook in Excel. This will either open by default when launching the Excel application, or you can choose “Blank Workbook” from the template

ContentsContents.....................................................................................................................................................................2

Objective / Scope........................................................................................................................................................3

Purpose.......................................................................................................................................................................3

Approach....................................................................................................................................................................3

Method 1: Open as a text file in Excel.....................................................................................................................4

Step 1: Change the file extension of the CSV-formatted file................................................................................4

Step 2: Open the file from Excel..........................................................................................................................6

Step 3: Follow the Text Import Wizard................................................................................................................8

Step 4: Save the Excel file....................................................................................................................................9

Step 5 (optional): Change settings back to hide file extensions.........................................................................10

Method 2: Import data into Excel using Text Import Wizard................................................................................11

Step 1: Import the data into Excel.....................................................................................................................11

Step 2: Follow the Text Import Wizard..............................................................................................................12

Step 3: Save the Excel file..................................................................................................................................14

Summary...................................................................................................................................................................15

Document Revision: V1.0 Page 2

Page 3: Contents · Web viewFirst open a blank workbook in Excel. This will either open by default when launching the Excel application, or you can choose “Blank Workbook” from the template

Objective / ScopeThe main objective of this document is to provide instructions for correctly opening data saved in the comma separated values (CSV) file format in Microsoft Excel, while preserving leading zeroes.

Important: Do not open a CSV-formatted file directly from Excel. Doing so will change any fields that Excel thinks is a number into the actual Excel number format, which will drop leading zeroes.

PurposeThis document provides two different methods for correctly opening CSV-formatted files in Excel. Both have the same end result, so users can decide which method works best for them.

ApproachThere are two options for correctly opening a CSV-formatted file in Excel. The first method requires changing the file extension from .csv to .txt before opening the file in Excel. The second method leaves the file extension as is and imports the data into a blank Excel workbook using the Text Import Wizard.

Both options start with a CSV-formatted file and finish with an Excel workbook file that can be used however you wish. You should choose only one of the methods to follow.

Document Revision: V1.0 Page 3

Page 4: Contents · Web viewFirst open a blank workbook in Excel. This will either open by default when launching the Excel application, or you can choose “Blank Workbook” from the template

Method 1: Open as a text file in Excel

Step 1: Change the file extension of the CSV-formatted file.

Navigate to your CSV-formatted file using Windows Explorer.

To show file extensions if they are not already visible:

Go to the Start menu and open the Control Panel. Type “Folder Options” in the search box. Click on “Folder Options.” (Note: In Windows 10, this link will be called “File Explorer Options” instead.)

Document Revision: V1.0 Page 4

Page 5: Contents · Web viewFirst open a blank workbook in Excel. This will either open by default when launching the Excel application, or you can choose “Blank Workbook” from the template

In the dialog box that opens, click on the second tab named “View.” Uncheck the box labeled “Hide extensions for known file types.” Click “OK.”

If you plan to change your computer setting back so that file extensions are once again hidden after opening the file, leave the Control Panel window open. Otherwise, close the Control Panel window.

If file extensions are already visible or after you have made them visible:

Go to the Windows Explorer window displaying the folder that contains your CSV-formatted file. Right-click on the file name and choose “Rename.”

Document Revision: V1.0 Page 5

Page 6: Contents · Web viewFirst open a blank workbook in Excel. This will either open by default when launching the Excel application, or you can choose “Blank Workbook” from the template

Replace the file extension “.csv” with “.txt” and click Enter. Click “Yes” in the warning dialog box to allow the change.

Step 2: Open the file from Excel.

Open a blank workbook in Excel. This will either open by default when launching the Excel application, or you can choose “Blank Workbook” from the template icons on the opening screen.

Document Revision: V1.0 Page 6

Page 7: Contents · Web viewFirst open a blank workbook in Excel. This will either open by default when launching the Excel application, or you can choose “Blank Workbook” from the template

Choose “Open” from the File menu and navigate to your folder in the Open dialog box. The text file will not be found in the folder initially because it does not have an Excel file extension. Change the dropdown box to the right of the File name box from “All Excel Files” to “All Files.” Then the text file will be available for selection. Choose the text file and click “Open.”

Document Revision: V1.0 Page 7

Page 8: Contents · Web viewFirst open a blank workbook in Excel. This will either open by default when launching the Excel application, or you can choose “Blank Workbook” from the template

Step 3: Follow the Text Import Wizard.

On the first window of the Text Import Wizard dialog box, ensure that “Delimited” is selected instead of “Fixed width” under the Original data type section and the box is checked for “My data has headers.” Click “Next.”

On the second window of the wizard, change the selection under the Delimiters heading by unchecking the box for “Tab” and checking the box for “Comma.” Click “Next.”

Document Revision: V1.0 Page 8

Page 9: Contents · Web viewFirst open a blank workbook in Excel. This will either open by default when launching the Excel application, or you can choose “Blank Workbook” from the template

On the third window of the wizard, the first step is to highlight all the columns of data in the preview pane at the bottom of the wizard. Do this by selecting the first column, scrolling right until the last column is visible, and holding the Shift key while selecting the last column of data. The second step is to select the “Text” option under the Column data format heading. Lastly, click “Finish.” This opens the spreadsheet with all columns formatted as text.

1

2

Keep the file with your data open. Close the blank Excel workbook you opened initially.

Step 4: Save the Excel file.

To save the workbook with your data as an Excel file, go to the File menu, choose “Save As,” and navigate to your folder.

Document Revision: V1.0 Page 9

Page 10: Contents · Web viewFirst open a blank workbook in Excel. This will either open by default when launching the Excel application, or you can choose “Blank Workbook” from the template

Change the dropdown menu for Save as type from “Unicode Text” to “Excel Workbook.” Click “Save.”

Step 5 (optional): Change settings back to hide file extensions.

Go back to the Control Panel window. Type “Folder Options” in the search box. Click on “Folder Options” (or “File Explorer Options” if you are using Windows 10). In the dialog box that opens, click on the second tab named “View.” Check the box labeled “Hide extensions for known file types.” Click “OK.” Close the Control Panel window.

Document Revision: V1.0 Page 10

Page 11: Contents · Web viewFirst open a blank workbook in Excel. This will either open by default when launching the Excel application, or you can choose “Blank Workbook” from the template

Method 2: Import data into Excel using Text Import Wizard

Step 1: Import the data into Excel.

First open a blank workbook in Excel. This will either open by default when launching the Excel application, or you can choose “Blank Workbook” from the template icons on the opening screen.

Click on the Data menu and choose “From Text” in the Get External Data section.

Document Revision: V1.0 Page 11

Page 12: Contents · Web viewFirst open a blank workbook in Excel. This will either open by default when launching the Excel application, or you can choose “Blank Workbook” from the template

Navigate to your folder in the Import Text File dialog box. Choose your CSV-formatted file and click “Import.”

Step 2: Follow the Text Import Wizard.

On the first window of the Text Import Wizard dialog box, ensure that “Delimited” is selected instead of “Fixed width” under the Original data type section and the box is checked for “My data has headers.” Click “Next.”

Document Revision: V1.0 Page 12

Page 13: Contents · Web viewFirst open a blank workbook in Excel. This will either open by default when launching the Excel application, or you can choose “Blank Workbook” from the template

On the second window of the wizard, change the selection under the Delimiters heading by unchecking the box for “Tab” and checking the box for “Comma.” Click “Next.”

On the third window of the wizard, the first step is to highlight all the columns of data in the preview pane at the bottom of the wizard. Do this by selecting the first column, scrolling right until the last column is visible, and holding the Shift key while selecting the last column of data. The second step is to select the “Text” option under the Column data format heading. Lastly, click “Finish.”

1

2

Document Revision: V1.0 Page 13

Page 14: Contents · Web viewFirst open a blank workbook in Excel. This will either open by default when launching the Excel application, or you can choose “Blank Workbook” from the template

When prompted for where to put the data, ensure that “Existing Worksheet” is selected and the cell reference is “=$A$1”. Click “OK.” This opens the spreadsheet with all columns formatted as text.

Step 3: Save the Excel file.

To save the workbook, go to the File menu, choose “Save As,” and navigate to your folder. Keep the default file type, which is Excel Workbook. Click “Save.”

Document Revision: V1.0 Page 14

Page 15: Contents · Web viewFirst open a blank workbook in Excel. This will either open by default when launching the Excel application, or you can choose “Blank Workbook” from the template

SummaryThis document provided two methods for correctly opening a CSV-formatted file in Excel without losing the leading zeroes in the data. Either method can be used to produce an Excel workbook file with all columns formatted as text.

Document Revision: V1.0 Page 15