We were created to excel

Содержание

  1. Exporting a Data Frame to custom formatted Excel
  2. Tutorial: Import Data into Excel, and Create a Data Model
  3. The sections in this tutorial are the following:
  4. Import data from a database
  5. Import data from a spreadsheet
  6. Import data using copy and paste
  7. Convert Word to Excel – A Step-By-Step Guide
  8. Steps to export Word to Excel
  9. Steps to converting Word to Excel online
  10. Conclusion

Exporting a Data Frame to custom formatted Excel

You might already be familiar with Pandas. Using Pandas, it is quite easy to export a data frame to an excel file. However, this exported file is very simple in terms of look and feel.

In this article we will try to make some changes in the formatting and try to make it more interesting visually.

For this job we will mostly use Pandas. And the data-set i’m going to use for this is some random credit card data. You can find the same here. I’m going to add some new columns to the following data-set for better understanding.

Let’s get started by importing pandas and numpy.

Reading the file:

“loc ”variable contains name of the folder where data-set file is present. You can directly put data-set file name along with the location in a single variable. I personally like concatenation. As you can see below, currently the file has 100 rows and 11 columns

Let’s add three more columns- “Balance”, “Credit Used” and “Credit Used Rate». For generating Balance we will use random.randint from numpy. For rest of the two columns, we can use simple math formulas.

If you notice, Credit Used Rate is in numbers but it should be in percentage format. We will change it afterwards. Now let’s save the above data frame to an excel file without changing any format. ExcelWriter is a class for writing Data-Frame into excel sheets. You can find more information about it here.

Let’s create another writer to save the formatted output file. Here we are using to_excel function for creating workbook

Now, let’s start the formatting. We will be making all the changes to the worksheet we created above.

Firstly, we will define the format variables, so that we can use them in the code where ever required. And, for this task we will use add_format.

Now, we will use above defined format variables in the worksheet using set_column.

Time to change header format. Zero in the below code implies 0th row which is basically the topmost row(Header Row).

lets show sum of certain numeric columns like “Balance”.

Saving the writer

The final output file would look like below file. You can see that format of some columns is changed. Header formatting is also differenct look different too

Now, You can change the formats on your own.

Источник

Tutorial: Import Data into Excel, and Create a Data Model

Abstract: This is the first tutorial in a series designed to get you acquainted and comfortable using Excel and its built-in data mash-up and analysis features. These tutorials build and refine an Excel workbook from scratch, build a data model, then create amazing interactive reports using Power View. The tutorials are designed to demonstrate Microsoft Business Intelligence features and capabilities in Excel, PivotTables, Power Pivot, and Power View.

Note: This article describes data models in Excel 2013. However, the same data modeling and Power Pivot features introduced in Excel 2013 also apply to Excel 2016.

In these tutorials you learn how to import and explore data in Excel, build and refine a data model using Power Pivot, and create interactive reports with Power View that you can publish, protect, and share.

The tutorials in this series are the following:

Import Data into Excel 2013, and Create a Data Model

In this tutorial, you start with a blank Excel workbook.

The sections in this tutorial are the following:

At the end of this tutorial is a quiz you can take to test your learning.

This tutorial series uses data describing Olympic Medals, hosting countries, and various Olympic sporting events. We suggest you go through each tutorial in order. Also, tutorials use Excel 2013 with Power Pivot enabled. For more information on Excel 2013, click here. For guidance on enabling Power Pivot, click here.

Import data from a database

We start this tutorial with a blank workbook. The goal in this section is to connect to an external data source, and import that data into Excel for further analysis.

Let’s start by downloading some data from the Internet. The data describes Olympic Medals, and is a Microsoft Access database.

Click the following links to download files we use during this tutorial series. Download each of the four files to a location that’s easily accessible, such as Downloads or My Documents, or to a new folder you create:
> OlympicMedals.accdb Access database
> OlympicSports.xlsx Excel workbook
> Population.xlsx Excel workbook
> DiscImage_table.xlsx Excel workbook

In Excel 2013, open a blank workbook.

Click DATA > Get External Data > From Access. The ribbon adjusts dynamically based on the width of your workbook, so the commands on your ribbon may look slightly different from the following screens. The first screen shows the ribbon when a workbook is wide, the second image shows a workbook that has been resized to take up only a portion of the screen.

Select the OlympicMedals.accdb file you downloaded and click Open. The following Select Table window appears, displaying the tables found in the database. Tables in a database are similar to worksheets or tables in Excel. Check the Enable selection of multiple tables box, and select all the tables. Then click OK.

The Import Data window appears.

Note: Notice the checkbox at the bottom of the window that allows you to Add this data to the Data Model, shown in the following screen. A Data Model is created automatically when you import or work with two or more tables simultaneously. A Data Model integrates the tables, enabling extensive analysis using PivotTables, Power Pivot, and Power View. When you import tables from a database, the existing database relationships between those tables is used to create the Data Model in Excel. The Data Model is transparent in Excel, but you can view and modify it directly using the Power Pivot add-in. The Data Model is discussed in more detail later in this tutorial.

Select the PivotTable Report option, which imports the tables into Excel and prepares a PivotTable for analyzing the imported tables, and click OK.

Once the data is imported, a PivotTable is created using the imported tables.

With the data imported into Excel, and the Data Model automatically created, you’re ready to explore the data.

Explore data using a PivotTable

Exploring imported data is easy using a PivotTable. In a PivotTable, you drag fields (similar to columns in Excel) from tables (like the tables you just imported from the Access database) into different areas of the PivotTable to adjust how it presents your data. A PivotTable has four areas: FILTERS, COLUMNS, ROWS, and VALUES.

It might take some experimenting to determine which area a field should be dragged to. You can drag as many or few fields from your tables as you like, until the PivotTable presents your data how you want to see it. Feel free to explore by dragging fields into different areas of the PivotTable; the underlying data is not affected when you arrange fields in a PivotTable.

Let’s explore the Olympic Medals data in the PivotTable, starting with Olympic medalists organized by discipline, medal type, and the athlete’s country or region.

In PivotTable Fields, expand the Medals table by clicking the arrow beside it. Find the NOC_CountryRegion field in the expanded Medals table, and drag it to the COLUMNS area. NOC stands for National Olympic Committees, which is the organizational unit for a country or region.

Next, from the Disciplines table, drag Discipline to the ROWS area.

Let’s filter Disciplines to display only five sports: Archery, Diving, Fencing, Figure Skating, and Speed Skating. You can do this from within the PivotTable Fields area, or from the Row Labels filter in the PivotTable itself.

Click anywhere in the PivotTable to ensure the Excel PivotTable is selected. In the PivotTable Fields list, where the Disciplines table is expanded, hover over its Discipline field and a dropdown arrow appears to the right of the field. Click the dropdown, click (Select All)to remove all selections, then scroll down and select Archery, Diving, Fencing, Figure Skating, and Speed Skating. Click OK.

Or, in the Row Labels section of the PivotTable, click the dropdown next to Row Labels in the PivotTable, click (Select All) to remove all selections, then scroll down and select Archery, Diving, Fencing, Figure Skating, and Speed Skating. Click OK.

In PivotTable Fields, from the Medals table, drag Medal to the VALUES area. Since Values must be numeric, Excel automatically changes Medal to Count of Medal.

From the Medals table, select Medal again and drag it into the FILTERS area.

Let’s filter the PivotTable to display only those countries or regions with more than 90 total medals. Here’s how.

In the PivotTable, click the dropdown to the right of Column Labels.

Select Value Filters and select Greater Than….

Type 90 in the last field (on the right). Click OK.

Your PivotTable looks like the following screen.

With little effort, you now have a basic PivotTable that includes fields from three different tables. What made this task so simple were the pre-existing relationships among the tables. Because table relationships existed in the source database, and because you imported all the tables in a single operation, Excel could recreate those table relationships in its Data Model.

But what if your data originates from different sources, or is imported at a later time? Typically, you can create relationships with new data based on matching columns. In the next step, you import additional tables, and learn how to create new relationships.

Import data from a spreadsheet

Now let’s import data from another source, this time from an existing workbook, then specify the relationships between our existing data and the new data. Relationships let you analyze collections of data in Excel, and create interesting and immersive visualizations from the data you import.

Let’s start by creating a blank worksheet, then import data from an Excel workbook.

Insert a new Excel worksheet, and name it Sports.

Browse to the folder that contains the downloaded sample data files, and open OlympicSports.xlsx.

Select and copy the data in Sheet1. If you select a cell with data, such as cell A1, you can press Ctrl + A to select all adjacent data. Close the OlympicSports.xlsx workbook.

On the Sports worksheet, place your cursor in cell A1 and paste the data.

With the data still highlighted, press Ctrl + T to format the data as a table. You can also format the data as a table from the ribbon by selecting HOME > Format as Table. Since the data has headers, select My table has headers in the Create Table window that appears, as shown here.

Formatting the data as a table has many advantages. You can assign a name to a table, which makes it easy to identify. You can also establish relationships between tables, enabling exploration and analysis in PivotTables, Power Pivot, and Power View.

Name the table. In TABLE TOOLS > DESIGN > Properties, locate the Table Name field and type Sports. The workbook looks like the following screen.

Save the workbook.

Import data using copy and paste

Now that we’ve imported data from an Excel workbook, let’s import data from a table we find on a web page, or any other source from which we can copy and paste into Excel. In the following steps, you add the Olympic host cities from a table.

Insert a new Excel worksheet, and name it Hosts.

Select and copy the following table, including the table headers.

Источник

Convert Word to Excel – A Step-By-Step Guide

This article is a detailed step-by-step guide to converting or exporting Word to Excel. We will look at different methods to export or convert a Word file to an Excel file in this article. So, read till the end to know multiple ways to convert your files.

Let’s get started!

Steps to export Word to Excel

Let’s get started with exporting an existing Word file on your system to Excel. Note that we’re not converting a Word file to an Excel spreadsheet here. We will discuss converting Word files later in this tutorial.

We already have unstructured data created in MS Word as an example.

Here are the steps to export an unstructured Word file to Excel.

  • Go to the File tab.
  • Click Save As.
  • Click Browse.
  • Choose Plain Text in the Save As type field.

  • Click OK when the File Conversion window appears.

Now, import this text file into Excel.

  • Open a blank Excel workbook or worksheet.
  • Go to the Data tab.
  • Click on From Text/CSV in the Get &Transform Data section.

  • Choose the saved text file from the file location.

  • Click on the Word file saved as a text file.
  • Click Import.

  • Check if your data is properly formatted. If you’re satisfied with the results click Load.
  • If you’re unsatisfied with the format, like this data above, click Transform Data.
  • Notice that there are two empty columns that we do not need. So, we will click Transform Data to fix this.

  • The Power Query editor opens to help you manage the imported data.
  • Right-click on the columns you want to delete.
  • Press Remove.
  • Once you’re done, click Close & Load in the Home tab.

You can see that the unstructured data from Word is exported to Excel in a structured format.

Let’s learn how to export structured or tabular data from Word to Excel.

To convert the data into a table.

  • Select the entire data in Word.
  • Go to the Insert tab.
  • Click on Table.
  • Click Insert Table.
  • Right-click on the columns you want to delete.
  • Press Delete Columns.

Your table is ready. Let’s export it to Excel.

This step is best for you if you don’t have Power Query in Excel.

  • Select the entire data table in Word. CTRL+A to Select All.
  • Copy the table. CTRL+C
  • Paste the table (CTRL+V) in Excel.

Your structured data is successfully exported.

If you’re on an older version of Office like 2007, 2010, 2013, or 2016, then follow these steps.

The initial step to export Word to Excel is the same in the older versions.

  • Save the Word file as a text file.
  • Go to the File tab.
  • Click Save As.
  • Click Browse.
  • Choose Plain Text in the Save As type field.
  • Click OK when the File Conversion window appears.

Now, import this text file into Excel.

  • Open a blank Excel workbook or worksheet.
  • Go to the Data tab.
  • Click on From Text/CSV in the Get &Transform Data section.
  • Choose the saved text file from the file location.
  • Click Open.

The Text Import Wizard opens with a few options.

  • Choose Delimited if you want to separate each field with existing commas, spaces, or tabs.
  • Choose Fixed Width if your fields are aligned properly.
  • Click Next.

You can see your data is separated with lines between them.

  • Double-click on a line to add or remove it.

  • Click Next.
  • Click Finish in the next step.
  • Click on a cell where you wish to export the data.
  • Click OK.

Your data is exported successfully.

Steps to converting Word to Excel online

You can also convert a Word file to Excel by following the steps below.

  • Go to Online2PDF.
  • Choose the Word file.
  • Choose the Excel version you want to convert.

Note that you cannot export to the Excel 365 version here.

Conclusion

This tutorial was a detailed step-by-step guide to converting and exporting Word files to Microsoft Excel. We walked through the different methods of exporting data from Word for both newer and older versions of Excel. Stay tuned for more interesting tutorials like these!

Источник

This article is a detailed step-by-step guide to converting or exporting Word to Excel. We will look at different methods to export or convert a Word file to an Excel file in this article. So, read till the end to know multiple ways to convert your files.

Let’s get started!

Also read: How to Convert Excel to PDF?

Steps to export Word to Excel

Let’s get started with exporting an existing Word file on your system to Excel. Note that we’re not converting a Word file to an Excel spreadsheet here. We will discuss converting Word files later in this tutorial.

We already have unstructured data created in MS Word as an example.

Word to Excel

Here are the steps to export an unstructured Word file to Excel.

  • Go to the File tab.
  • Click Save As.
  • Click Browse.
  • Choose Plain Text in the Save As type field.
plain
  • Click OK when the File Conversion window appears.
file conversion

Now, import this text file into Excel.

  • Open a blank Excel workbook or worksheet.
  • Go to the Data tab.
  • Click on From Text/CSV in the Get &Transform Data section.
text csv
  • Choose the saved text file from the file location.
text file
  • Click on the Word file saved as a text file.
  • Click Import.
load page
  • Check if your data is properly formatted. If you’re satisfied with the results click Load.
  • If you’re unsatisfied with the format, like this data above, click Transform Data.
  • Notice that there are two empty columns that we do not need. So, we will click Transform Data to fix this.
powerquery
  • The Power Query editor opens to help you manage the imported data.
  • Right-click on the columns you want to delete.
  • Press Remove.
  • Once you’re done, click Close & Load in the Home tab.
closeload
imported unstructured

You can see that the unstructured data from Word is exported to Excel in a structured format.

Let’s learn how to export structured or tabular data from Word to Excel.

structured word

To convert the data into a table.

  • Select the entire data in Word.
  • Go to the Insert tab.
  • Click on Table.
  • Click Insert Table.
  • Right-click on the columns you want to delete.
  • Press Delete Columns.

Your table is ready. Let’s export it to Excel.

This step is best for you if you don’t have Power Query in Excel.

  • Select the entire data table in Word. CTRL+A to Select All.
  • Copy the table. CTRL+C
  • Paste the table (CTRL+V) in Excel.

Your structured data is successfully exported.

If you’re on an older version of Office like 2007, 2010, 2013, or 2016, then follow these steps.

The initial step to export Word to Excel is the same in the older versions.

  • Save the Word file as a text file.
  • Go to the File tab.
  • Click Save As.
  • Click Browse.
  • Choose Plain Text in the Save As type field.
  • Click OK when the File Conversion window appears.

Now, import this text file into Excel.

  • Open a blank Excel workbook or worksheet.
  • Go to the Data tab.
  • Click on From Text/CSV in the Get &Transform Data section.
  • Choose the saved text file from the file location.
  • Click Open.

The Text Import Wizard opens with a few options.

text import
  • Choose Delimited if you want to separate each field with existing commas, spaces, or tabs.
  • Choose Fixed Width if your fields are aligned properly.
  • Click Next.

You can see your data is separated with lines between them.

  • Double-click on a line to add or remove it.
preview
  • Click Next.
  • Click Finish in the next step.
  • Click on a cell where you wish to export the data.
  • Click OK.
cell location

Your data is exported successfully.

Steps to converting Word to Excel online

You can also convert a Word file to Excel by following the steps below.

  • Go to Online2PDF.
  • Choose the Word file.
  • Choose the Excel version you want to convert.
word
  • Click Convert.

Note that you cannot export to the Excel 365 version here.

Conclusion

This tutorial was a detailed step-by-step guide to converting and exporting Word files to Microsoft Excel. We walked through the different methods of exporting data from Word for both newer and older versions of Excel. Stay tuned for more interesting tutorials like these!

References- Computer Hope


Download Article


Download Article

If you need to move a list or table of data from Word into Excel, you don’t have to copy and paste each individual piece of information into its own cell in the spreadsheet. By properly formatting your Word document first, you can easily import the entire document into Excel with just a few clicks.

  1. Image titled Convert Word to Excel Step 1

    1

    Understand how the document will be converted. When you import a document into Excel, certain characters will be used to determine what data goes into each cell in the Excel spreadsheet. By performing a few formatting steps before importing, you’ll be able to control how the final spreadsheet appears and minimize the amount of manual formatting you have to perform. This is especially useful if you are importing a large list from a Word document into Excel.

    • This method works best when you have a list of multiple entries, each formatted the same (list of addresses, phone numbers, email addresses, etc.).
  2. Image titled Convert Word to Excel Step 2

    2

    Scan the document for any formatting errors. Before beginning the conversion process, you’ll want to ensure that each entry is formatted in the same way. This means fixing any punctuation errors or reorganizing any entries that don’t match the rest. This will ensure that the data transfers properly.

    Advertisement

  3. Image titled Convert Word to Excel Step 3

    3

    Display the formatting characters in your Word document. Displaying the normally hidden formatting characters will help you determine the best way to split up the entries. You can display them by clicking the «Show / Hide Paragraph Marks» button in the Home tab or by pressing Ctrl+ Shift+*

    • Most lists will either have one paragraph mark at the end of each line, or one at the end of the line and one in the blank line between entries. You will be using the marks to insert the characters used by Excel to differentiate between cells.
  4. Image titled Convert Word to Excel Step 4

    4

    Replace the paragraph marks between each entry to get rid of extra space. Excel will use space between entries to determine the rows, but you’ll need to get rid of it for now to help the formatting process. Don’t worry, you’ll be adding it back in a little bit. This works best when you have one paragraph mark at the end of an entry and one in the space between entries (two in a row).

    • Press Ctrl+H to open the Find and Replace window.
    • Type ^p^p into the Find field. This is the code for two paragraph marks in a row. If each entry is a single line and there are no blank lines between them, use a single ^p instead.
    • Enter a delimiting character into the Replace field. Make sure that it isn’t a character that appears anywhere in the document, such as ~.
    • Click Replace All. You’ll notice that the entries may combine themselves, but that’s not a concern right now as long as the delimiting character is in the right place (between each entry)
  5. Image titled Convert Word to Excel Step 5

    5

    Separate each entry into separate fields. Now that your entries are separated so that they appear in subsequent rows, you’ll want to define what data will appear in each field. For example, if each entry is a name on the first line, a street address on the second line, and a state and zip code on the third line, you can

    • Press Ctrl+H to open the Find and Replace window.
    • Remove one of the ^p marks in the Find field.
    • Change the character in the Replace field to a comma ,.
    • Click Replace All. This will replace the remaining paragraph symbols with the comma separator, which will separate each line into a field.
  6. Image titled Convert Word to Excel Step 6

    6

    Replace the delimiting character to finish the formatting process. Once you’ve done the two Find-and-Replace steps above, your list will not look like a list anymore. Everything will be on the same line, with commas between every piece of data. This final Find-and-Replace step will return your data to a list while keeping the commas that define the fields.

    • Press Ctrl+H to open the Find and Replace window.
    • Enter ~ (or whatever character you chose originally) into the Find field.
    • Enter ^p into the Replace field.
    • Click Replace All. This will break your entries back into individual groupings separated by the commas.
  7. Image titled Convert Word to Excel Step 7

    7

    Save the file as a plain text file. Now that your formatting is complete, you can save the document as a text file. This will allow Excel to read and parse your data so that it goes in the correct fields.

    • Click the File tab and select «Save As».
    • Click the «Save as type» drop-down menu and select «Plain Text».
    • Name the file as you prefer and click Save.
    • If the File Conversion window appears, just click    OK   .
  8. Image titled Convert Word to Excel Step 8

    8

    Open the file in Excel. Now that you’ve saved the file in plain text, you can open it up in Excel.[1]

    • Click the File tab and select Open.
    • Click the «All Excel Files» drop-down menu and select «Text Files».
    • Click Next > in the Text Import Wizard window.
    • Select «Comma» in the Delimiter list. You can see how the entries will be separated in the preview at the bottom. Click Next >.
    • Select the data format for each of the columns and click Finish.
  9. Advertisement

  1. Image titled Convert Word to Excel Step 9

    1

    Make a table in Word with your data. If you have a list of data in Word, you can convert it to a table format in Word and then quickly copy that table into Excel. If your data is already in table format, skip down to the next step.

    • Select all of the text that you want to convert into a table.
    • Click the Insert tab and then click the Table button.
    • Select «Convert Text to Table».
    • Enter the number of lines per record in the the «Number of columns» field. If you have a blank line between each record, add one to the total.
    • Click    OK   .
  2. Image titled Convert Word to Excel Step 10

    2

    Check the formatting of your table. Word will generate a table based on your settings. Double-check it to ensure that everything is where it should be.

  3. Image titled Convert Word to Excel Step 11

    3

    Click the little «+» button that appears in the upper-left corner of the table. This will show up when you’re hovering the mouse over the table. Clicking this will select all of the data in the table.

  4. Image titled Convert Word to Excel Step 12

    4

    Press .Ctrl+C to copy the data. You can also click the «Copy» button in the Home tab.

  5. Image titled Convert Word to Excel Step 13

    5

    Open Excel. Once the data has been copied, you can open Excel. If you want to put the data in an existing spreadsheet, load it up. Place your cursor in the cell that you want the upper-left cell of the table to appear.

  6. Image titled Convert Word to Excel Step 14

    6

    Press .Ctrl+V to paste the data. The individual cells from the Word table will be placed into separate cells in the Excel spreadsheet.

  7. Image titled Convert Word to Excel Step 15

    7

    Split any remaining columns. Depending on the type of data you are importing, you may have some additional formatting you need to do. For example, if you are importing addresses the city, state abbreviation, and zip code may be all in the same cell. You can have Excel split these up automatically.[2]

    • Click the column heading of the column you want to split to select the whole column.
    • Select the «Data» tab and click the «Text to Columns» button.
    • Click Next > and then select the «Comma» in the Delimiters field. If you are using the above example, this will separate the city from the state abbreviation and zip code.
    • Click Finish to save the changes.
    • Select the column that still needs to be split and repeat the process, selecting «Space» instead of «Comma» as the delimiter. This will separate the state abbreviation from the zip code.
  8. Advertisement

Ask a Question

200 characters left

Include your email address to get a message when this question is answered.

Submit

Advertisement

Thanks for submitting a tip for review!

About This Article

Thanks to all authors for creating a page that has been read 208,091 times.

Is this article up to date?

One item I’ve learned from using computers is that there is usually more than one way to solve a problem. Recently, two people approached me with a similar problem. They were trying to get a Microsoft Word mailing list into Microsoft Excel. One tried to use macros, and the other resorted to cut and paste. In each case, I thought a simpler solution involved Word’s Search and Replace feature. In this tutorial, I’ll show how to convert a Word document to Excel.

The Starting Address Format

For this tutorial, I’m using Microsoft 365. The steps are very similar in older versions of Microsoft Word and Microsoft Excel. The main difference is the user interface.

Each user started with a list of names and addresses in Microsoft Word. I suspect they were some address directory or contact list. For various reasons, they needed to get the data into Microsoft Excel. However, they wanted one row for each contact record. Also, they wanted to split the data into distinct columns. Thus, the address record looked like the records below.

James Madison
124 Main St
Anytown, NY 12345

Paula Harris
356 Longtree View
Harper, MA 01073

Before starting, review your address list and look for common denominators and possible exceptions. In these cases, the records were uniform, with each contact consisting of three lines with a blank line in between.

Another approach you could take is to convert the list to a Word table and then copy it to Excel. It really depends on how comfortable you are with Word and Excel. As I said, there are multiple solutions.

Creating the Record Delimiter

The first step in this process is to add a record delimiter. This is the item Excel will look for to separate each contact.

  1. Open your Word document.
  2. Turn on Paragraph marks using Ctrl + Shift + * or click the Paragraph button on the Home menu.
  3. Notice how a paragraph mark exists at the end of each record. We’ll substitute a unique character as a record delimiter.

I like to use the tilde ~ sign, but you can use any uncommon character. Be careful not to use a character that appears on your list. For example, if your list also included email addresses, you wouldn’t want to use the @ sign as your field delimiter.

  1. Go to the top of your document. Ctrl + Home.
  2. From the Editing group, select Replace.
  3. Click the Replace tab.
  4. Click the More >> button at the bottom. Your dialog will now show more Search Options.
  5. Click the Special button.
  6. Select Paragraph Mark from the pop-up menu.
  7. Enter the symbol you wish to use for your record delimiter, such as a tilde in the Replace with: textbox.

Your Find and Replace dialog should look like the one below.

Word Find and Replace with paragraph marks ^p
  1. Click Replace All.
  2. Click Close.

Microsoft Word will show a count of how many replacements it made. So don’t worry that your formatting looks off and various lines look combined.

Defining the Fields

The next part is to define our fields which will be placed in Excel columns. Each record had 3 lines representing: Name, Address, and City, ST, and Zip. In this example, we’re going to use a comma to separate these fields. We can parse the Names and State in Excel later.

  1. Go to the top of your document.
  2. From the Edit menu, select Replace.
  3. Your Find and Replace dialog will retain your previous values.
  4. In the Find what: text box, clear your previous entry. Click Special and select Manual line break from the popup menu. This will add a ^l.
  5. In the Replace with: text box, clear out the tilde and enter a comma.
  6. Click Replace All.
  7. Click Close.

Breaking Apart the Records

Your document probably looks worse, but don’t worry about it. Part of this may be word wrap, and part of it is our formatting.

Records seperated by commas and tildes.

Records with comma separators and tildes

The next steps will put it into perspective.

  1. Go to the top of your document
  2. From the Edit menu, select Replace.
  3. Replace the Manual Line break code in the Find what: text box with a tilde.
  4. In the Replace with: textbox, clear the comma and enter ^l for a manual line break.
  5. Click Replace All.
  6. Click Close.

If you have extra commas or paragraph marks on the last line, you can delete them. If you’re really fastidious and don’t like the space before the State, you can do another “search and replace” or fix it in Excel.

Saving the File

Your document should now have 1 record per line with the fields separated by a comma and ending with a manual line break symbol . There will not be a comma between state and zip code.

List of addresses with one record per line.

Address records seperated by line breaks
  1. From the File menu, select Save As.
  2. In the Save As dialog, enter your file name.
  3. In the Save as type: drop-down menu, select Plain Text.
  4. Word may display a File Conversion dialog with a warning that all formatting will be lost. Don’t worry and click OK to accept the default values.

Word File conversion warning.

Keep the default conversion settings

Pulling the File into Microsoft Excel

The last part is to import our Microsoft Word text file into Excel.

  1. Open Excel
  2. From the File menu, select Open.
  3. Click Browse.
  4. In the Open dialog, change the Files of Type: entry to Text Files (*.prn;*.txt;*.csv)
  5. Point to your .txt file.
  6. Click Open
  7. The Text Import Wizard should start. Keep the default values and click Next >.
  8. In Step 2, change your Delimiter from Tab to Comma. The screen should adjust to show the values in columns.
  9. In Step 3, you can change the data format for each column or click Finish to accept the General format.

Address pulled into Excel with columns.

Mailing addresses after parsing

Final Tweaks and Thoughts

Chances are you will want to do some minor tweaking. For example, you probably want to add Excel column labels. If you have US addresses, you may want to split the last column with the State and Zipcode into separate columns. This can be done with the Text to Columns feature. However, if you have zip codes with leading zeros, make sure you don’t drop lose them.

You may also want to split the name column into first and last names. In our example, this is easy as 1 space separates the first and last name. The same is true for the state and zip code. Sometimes, you may have more complicated needs like putting the street number in its own field. In those cases, you can use an Excel formula to pull out substrings.

While these steps may not map precisely for your list, they should provide the basic steps for creating the records in Microsoft Word. Your list may be slightly different or include more items such as email addresses. Either way, you could use a similar framework to create a document that Microsoft Excel can interpret.

Now that you’ve learned how to convert the Word doc to Excel, take some time to reflect if Word was the best tool for the job. I appreciate both Word and Excel, but each has its strengths and weaknesses. If you received such a list from a co-worker, it might be a good time to review how information is captured.

  • Quick Guide to XLOOKUP in Excel
  • How to Freeze Panes in Excel (Sticky Header)
  • How to Transpose Columns and Rows in Excel

Power Query is an extremely useful feature that allows us to:

  • connect to different data sources, like text files, Excel files, databases, websites, etc…
  • transform the data based on report prerequisites.
  • save the data into an Excel table, data model, or simply connect to the data for later loading.

The best part is that if the source data changes, you can update the destination results with a single click; something that is ideal for data that changes frequently.

This is analogous to recording and executing a macro.  But unlike a macro, the creation and execution of the back-end code happen automatically.

If you can click buttons, you can create automated Power Query solutions.

Example #1

Import Spot Prices for Petroleum

from a Website to Excel

The first step is to connect to the data source.  For this example, we will connect to the U.S. Energy Information Administration.

https://www.eia.gov/petroleum

The information we need is in a table that is part of the overall webpage.

In the “old days”, we would transfer the information from the website into Excel by highlighting the webpage table and copy/paste the data into Excel.

If you’ve ever done this, you know what a hit-or-miss proposition this can be.  It’s the 50/50/90 Rule: if you have a 50/50 chance of winning, you’ll lose 90% of the time.

Even if you were to successfully transfer the information into Excel, the information is not linked to the webpage.  When the webpage changes, you will need to recopy/paste (and potentially fix) the updated information.

  1. Begin by copying the URL from the webpage (assuming you are previewing the page in a browser). If not, you can type it into the next step’s URL prompt.
  2. Select Data (tab) -> Get & Transform (group) -> From Web.

  1. In the From Web dialog box, paste the URL into the URL field and click OK.

The Navigator window displays the components of the webpage in the left panel.

If you want to ensure you are on the correct webpage, click the tab labeled Web View to get a preview of the page in a traditional HTML format.

It is unlikely that the listed components on the left will be presented with obvious names as to which item goes to which webpage component. You may need to click from one item to the next, previewing each item in the right-side preview panel, in order to determine which belongs to the desired table.

If the data does not require any further transformations, you can click Load/Load To… to send the data directly to Excel.  This will allow you to select the destination of the results data, such as a table on a new or existing worksheet, the Data Model, or create a “Connection Only” to the source data.

  1. In the Navigator dialog box, select the arrow next to Load and click Load To…

  1. In the Import Data dialog box, select “Existing worksheet” and point to a cell on your desired destination worksheet (like cell A1 on “Sheet1”).

The result is a table that is connected to a query.  The Queries & Connections panel (right) lists all existing queries in this file.

If you hover over a query, an information window will appear giving you the following information:

  • a preview of the data
  • the number of imported columns
  • the last refresh date/time
  • how the data was loaded or connected to the Excel file
  • the location of the source data

Although the data looks correct, we have some structural issues with the results that will cause problems with further analysis.

The empty cells in the Product column will cause problems when sorting, filtering, charting, or pivoting the data.

We need to make some adjustments to the data.

  1. Double-click (or right-click and choose Edit) the listed query to activate the Power Query Editor.

We want to fill down the listed products into the lower, empty cells of the Product column.

  1. In the Power Query Editor, select the Product column and click Transform (tab) -> Any Column (group) -> Fill -> Down.

Nothing happened.

The reason the product names failed to repeat down through the empty cells is that Power Query did not interpret the cells as empty.  There may be some artifact from the webpage that exists in the cell that we can’t see.

We will replace all the “fake empty” cells with null values.  This should allow the Fill Down operation to work as expected.

  1. Select the Changed Type step in the Query Settings panel (right).

  1. Select the Product column and click Transform (tab) -> Any Column (group) -> Replace Values.

  1. Tell Power Query that you wish to insert this new step into the existing query by clicking Insert.

  1. In the Replace Values dialog box, leave the “Value To Find” field empty and type “null” (no quotes) in the “Replace With” field. Click OK when finished.

If you select the previously created “Filled Down” step at the bottom of the Query Settings panel you will see the updated results of the query.

  1. Update the query name to “Spot Prices”.

  1. Click the top part of the Close & Load button at the far-left of the Home

If we were to graph the data, and the data were to change, we can refresh our graph by clicking Data (tab) -> Queries & Connections (group) -> Refresh All or right-click on the data and select Refresh.

Query Options

There are some controllable options available by selecting Data (tab) -> Queries & Connections (group) -> Refresh All -> Connection Properties…

Some of the more popular options include:

  • Refresh the data every N number of minutes
  • Refresh the data when opening the file
  • Opting for participation during a Refresh All operation

Example #2

Import Weather Forecast

for the Next 10 Days

Imagine you work at the front desk of a popular hotel in New York City.  As a customer service, you wish to supply your guests with a printout of the weather forecast for the next 10 days.

This is something that needs to be printed every day where each successive day looks at its next 10 days.

  1. We start by searching for a website that can supply a 10-day forecast for Seattle.

  1. We take the first offer in the search results that takes us to weather.com.

  1. Now that we have the web link to the 10-day forecast for New York City, we will copy and paste it into a web query in Excel (Data (tab) -> Get & Transform (group) -> From Web).
  2. Select the table from the left side of the Navigator window.

We can see from the preview that there are some columns towards the right that we are not interested in and the column headers have shifted.

  1. In the Navigator window, select Transform Data to load the forecast into Power Query.
  2. Begin editing the data by right-clicking on the header for the “Day” column and select Remove.

  1. Select the last 3 columns (“Wind”, “Humidity”, and “Column7”) and remove them as well.
  2. Rename the remaining 3 columns.
    • Description -> Day
    • High / Low -> Description
    • Precip -> High/Low
  1. Rename the query “SeattleWeather”.
  2. On the Home tab, select the lower-part of the Close & Load button and click Close & Load To… and select Existing Worksheet from the Import Data dialog box. Click OK when complete.

We now have the weather forecast for the next 10 days.

Each day, we only need right-click the table to refresh the information.

Impressing the Boss

We really like the idea seen on the original weather.com website that displays a raincloud emoji for days that are expecting rain.

To bring a bit of fun to our report, we will have Excel display an umbrella emoji for any day that is forecasting rain or showers.

NOTE: This creative bit of Excel trickery is brought to us by our good friends Frédéric Le Guen and Oz du Soleil.  Links to their blog and video detail various uses of this trick can be found at the end of this post.

The first step is to add the umbrella emoji.  We will access the built-in Windows emoji library.

  1. On the keyboard, press the Windows key and the period to display the emoji library.

  1. Type the word “rain” to filter the emoji library to rain-related emojis.
  2. Select the umbrella with raindrops.

  1. Highlight the umbrella emoji in the Formula Bar and press Copy (CTRL-C) then Enter.
  2. Double-click the “SeattleWeather” query to launch the Power Query Editor.

The next step is to create a new column that adds the umbrella emoji for any row that contains the words “rain” or “shower” in the Description column.

  1. Select Add Column (tab) -> General (group) -> Conditional Column.

  1. The name of the new column is “Be Equipped” and the logic is “if the column named ‘Description’ contains the word ‘rain’ then display the umbrella emoji”. (Paste the umbrella emoji into the Output)
  2. Click the Add Clause button to create a second condition.
  3. The second description’s logic is “else if the column named ‘Description’ contains the word ‘shower’ then display the umbrella emoji”. (Paste the umbrella emoji into the Output)

  1. Click OK to add the new conditional column.

  1. Drag the header for “Be Equipped” so the new column lies between the “Description” and “High/Low” columns.

  1. Close & Load the updated query back into Excel.

Tomorrow, you only need right-click the table to load the updated 10-day weather forecast.

Interesting Links

Frédéric Le Guen’s blog post on adding emojis to your reports

Oz’s video – Emojis, Excel, Power Query & Dynamic Arrays

Practice Workbook

Feel free to Download the Workbook HERE.

Excel Download Practice file

Published on: December 15, 2019

Last modified: March 10, 2023

Microsoft Most Valuable Professional

Leila Gharani

I’m a 5x Microsoft MVP with over 15 years of experience implementing and professionals on Management Information Systems of different sizes and nature.

My background is Masters in Economics, Economist, Consultant, Oracle HFM Accounting Systems Expert, SAP BW Project Manager. My passion is teaching, experimenting and sharing. I am also addicted to learning and enjoy taking online courses on a variety of topics.

Понравилась статья? Поделить с друзьями:
  • We use this word to express strong obligation
  • We use this word in result clauses
  • We cant imagine a word without
  • We can use the word to change the subject
  • We can use the word office