How to extract multiple tables from word doc to single excel sheet

srini0712

New Member
Joined
Aug 21, 2020
Messages
8
Office Version
  1. 365
Platform
  1. Windows
How can i extract multiple tables (each table having multiple rows & columns and are different from each other) from a word document into single excel sheet. is it possible for the extracted tables to be displayed in separate worksheets with in the excel sheet.
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
I think it can be done through power query @sandy666 can help
I'd like to see how Power Query can extract tables directly from MS Word. Could you show this?
I can do it via XML or html from Word but never seen it directly from docx file
or
watch your own business, please
 
Last edited:
Upvote 0
Oh sorry if I offended you.
From now I will alway mind my own business. Thanks
 
Upvote 0
@srini0712
you'll need somehow
- extract xml from docx and import into excel, or
- save docx as html, and import into excel or
- use vba to get tables from docx to excel
then you can try Power Query to merge or append tables depending on their structure
 
Upvote 0
Hi srini

I have tried to do it and it works and the trick is if you save the word file as PDF and then extract data through power query it works.

I will try to help if you can provide me a sample pages of your word file.
 
Upvote 0
it's possible with XL365 for subscribers Beta channel (maybe something was changed from June 2020) and Power BI but not on XL2016 as OP showed in his profile
 
Upvote 0
I hardly use Word. The following is the code I use to extract a Word table to Excel. It should be easy to modify the code to extract multiple tables but I don't have a file to test.

VBA Code:
Sub extract_table_from_word()

Dim wdApp As Word.Application, wdDoc As Word.Document
Dim oWdRange As Word.Range
Dim wdCell As Object

Application.DisplayAlerts = False
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual

On Error Resume Next

Set wdApp = GetObject(, "Word.Application")

If Err.Number <> 0 Then 'Word isn't already running

Set wdApp = CreateObject("Word.Application")

End If

   wdApp.Visible = True
   Set wdDoc = wdApp.ActiveDocument

For Each wdCell In wdDoc.Tables(2).Range.Cells
  With wdCell
    ThisWorkbook.Sheets(1).Cells(.RowIndex, .ColumnIndex) = .Range.Text
  End With
Next
On Error GoTo 0

Application.DisplayAlerts = True
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic

End Sub
 
Upvote 0
Hi srini

I have tried to do it and it works and the trick is if you save the word file as PDF and then extract data through power query it works.

I will try to help if you can provide me a sample pages of your word file.
I have tried this and when i select the pdf to extract data through power query i am getting an error. this may be due to the length of the doc file and the large amount of data within it.
i need to export tables from the requirements document under particular sections. i have created a sample doc file which has 2 tables (requirement 1 & requirement 2 tables) in page 9.
 
Upvote 0

Forum statistics

Threads
1,215,084
Messages
6,123,021
Members
449,092
Latest member
ikke

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top