Forum

Extracting Excel fi...
 
Notifications
Clear all

Extracting Excel file properties by Power Query

7 Posts
3 Users
0 Reactions
766 Views
(@julian)
Posts: 82
Estimable Member
Topic starter
 

Is it a way to get the Excel file author information by using Power Query?Ichecked the attributes column from power query but no "author" included.

 
Posted : 05/01/2017 10:17 pm
(@db325)
Posts: 19
Active Member
 

You could use a User Defined Function (UDF) to give you the information:

Function Author()

Author = ThisWorkbook.BuiltinDocumentProperties("Author")

End Function

Then in a worksheet cell, enter:

=Author()

 
Posted : 06/01/2017 5:52 am
(@julian)
Posts: 82
Estimable Member
Topic starter
 

I've used Power Query to get a long list of Excel files and I wanted to add a custom column populating the related author for each row. Function Author() can get the author information from a single open book, right?

 
Posted : 06/01/2017 9:33 am
(@julian)
Posts: 82
Estimable Member
Topic starter
 

Hi Derek ,

I got the following VBA script the other day, but still had no way to retrieve the file author with the line I highlighted in bold font type. Could you please check it out and make necessary modification for me. I would appreciate it.

Sub ListFiles()
    iRow = 11
    Call ListMyFiles(Range("C7"), Range("C8"))
End Sub

Sub ListMyFiles(mySourcePath, IncludeSubfolders)
    Set MyObject = New Scripting.FileSystemObject
    Set mySource = MyObject.GetFolder(mySourcePath)
    On Error Resume Next
    For Each myFile In mySource.Files
        iCol = 2
        Cells(iRow, iCol).Value = myFile.Path
        iCol = iCol + 1
        Cells(iRow, iCol).Value = myFile.Name
        iCol = iCol + 1
        Cells(iRow, iCol).Value = myFile.Size
        iCol = iCol + 1
        Cells(iRow, iCol).Value = myFile.Owner
        iRow = iRow + 1
    Next
    If IncludeSubfolders Then
        For Each mySubFolder In mySource.SubFolders
            Call ListMyFiles(mySubFolder.Path, True)
        Next
    End If
End Sub

 
Posted : 08/01/2017 11:17 am
(@catalinb)
Posts: 1937
Member Admin
 

You also opened a new topic with the same text, please don't open multiple threads with the same subject. One is enough, don't worry, we'll help you 🙂

Here is the link to your other post, where the answer is: vba-macros/get-metadata-of-files-in-folders

 
Posted : 09/01/2017 9:55 am
(@julian)
Posts: 82
Estimable Member
Topic starter
 

Sorry for that, I thought it should be under the topic of VAB & Macros. Besides, I tried your answered script but still failed to get the solution. Let's come back to the VBA & Macros forum for futher discussion. Sorry again for violating the rules..... 

 
Posted : 09/01/2017 7:16 pm
(@catalinb)
Posts: 1937
Member Admin
 

No worries, let's continue on the other topic 🙂

 
Posted : 10/01/2017 1:10 am
Share: