புதன், 28 ஏப்ரல், 2021

dropdown box (Menu) create using CSS

 


Basic Dropdown

Create a dropdown box that appears when the user moves the mouse over an element.

Example

<style>
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-content {
  display: none;
  position: absolute;
  background-color: #f9f9f9;
  min-width: 160px;
  box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
  padding: 12px 16px;
  z-index: 1;
}

.dropdown:hover .dropdown-content {
  display: block;
}
</style>

<div class="dropdown">
  <span>Mouse over me</span>
  <div class="dropdown-content">
    <p>Hello World!</p>
  </div>
</div>
Try it Yourself »

Example Explained

HTML) Use any element to open the dropdown content, e.g. a <span>, or a <button> element.

Use a container element (like <div>) to create the dropdown content and add whatever you want inside of it.

Wrap a <div> element around the elements to position the dropdown content correctly with CSS.

CSS) The .dropdown class uses position:relative, which is needed when we want the dropdown content to be placed right below the dropdown button (using position:absolute).

The .dropdown-content class holds the actual dropdown content. It is hidden by default, and will be displayed on hover (see below). Note the min-width is set to 160px. Feel free to change this. Tip: If you want the width of the dropdown content to be as wide as the dropdown button, set the width to 100% (and overflow:auto to enable scroll on small screens).

Instead of using a border, we have used the CSS box-shadow property to make the dropdown menu look like a "card".

The :hover selector is used to show the dropdown menu when the user moves the mouse over the dropdown button.



Dropdown Menu

Create a dropdown menu that allows the user to choose an option from a list:

This example is similar to the previous one, except that we add links inside the dropdown box and style them to fit a styled dropdown button:

Example

<style>
/* Style The Dropdown Button */
.dropbtn {
  background-color: #4CAF50;
  color: white;
  padding: 16px;
  font-size: 16px;
  border: none;
  cursor: pointer;
}

/* The container <div> - needed to position the dropdown content */
.dropdown {
  position: relative;
  display: inline-block;
}

/* Dropdown Content (Hidden by Default) */
.dropdown-content {
  display: none;
  position: absolute;
  background-color: #f9f9f9;
  min-width: 160px;
  box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
  z-index: 1;
}

/* Links inside the dropdown */
.dropdown-content a {
  color: black;
  padding: 12px 16px;
  text-decoration: none;
  display: block;
}

/* Change color of dropdown links on hover */
.dropdown-content a:hover {background-color: #f1f1f1}

/* Show the dropdown menu on hover */
.dropdown:hover .dropdown-content {
  display: block;
}

/* Change the background color of the dropdown button when the dropdown content is shown */
.dropdown:hover .dropbtn {
  background-color: #3e8e41;
}
</style>

<div class="dropdown">
  <button class="dropbtn">Dropdown</button>
  <div class="dropdown-content">
    <a href="#">Link 1</a>
    <a href="#">Link 2</a>
    <a href="#">Link 3</a>
  </div>
</div>
Try it Yourself »

Right-aligned Dropdown Content

If you want the dropdown menu to go from right to left, instead of left to right, add right: 0;

Example

.dropdown-content {
  right: 0;
}
Try it Yourself »

More Examples

Dropdown Image

How to add an image and other content inside the dropdown box.

Hover over the image:


Try it Yourself »

Dropdown Navbar

How to add a dropdown menu inside a navigation bar.

திங்கள், 12 ஏப்ரல், 2021

3 Ways to Unlock or Remove PDF Permissions Password with Ease

 

3 Ways to Unlock or Remove PDF Permissions Password with Ease

Unable to edit a PDF document with read-only restriction? How do I remove printing restriction from a PDF file? When you forgot the permissions password (also known as owner password) of a secured PDF file, you'll be unable to edit, copy or print its contents. In this tutorial we'll show you 3 simple ways to unlock or remove PDF permissions password (owner password) with ease.

Method 1: Unlock or Remove PDF Permissions Password with Acrobat Pro

The official way to remove PDF password is to use the Adobe Acrobat Pro tool. If you can remember the original permissions password, you can unlock and remove all types of security restrictions on your PDF document in several simple steps.

  1. Open your secured PDF document with Acrobat Pro. Click the File menu and then select Properties.

  2. When the Document Properties dialog box appears, go to the Security tab. The document restrictions summary shows which operations are not allowed. To remove all those restrictions, you have to choose "No Security" from the "Security Method" drop-down list.

  3. A window should appear saying your PDF document is protected. Enter your current PDF permissions password and click OK.

  4. Click OK to confirm that you want to remove security from this document.

  5. Save your changes, the permissions password will be removed from the original PDF file.

Method 2: Unlock or Remove PDF Permissions Password with Chrome

You will be quite surprised to know that Chrome has a built-in PDF reader / writer feature which could be utilized to unlock and remove PDF permissions password. Let's see how:

  1. Open the Google Chrome browser, drag and drop your protected PDF document into the existing or a new tab. The browser will prompt you to enter the permissions password. Enter the password and click OK to open file.
  2. Click the Print icon on the PDF viewer toolbar or press the Ctrl + P keyboard combination.

  3. Under the Destination section, click the Change button to select "Save as PDF". Next, click on the Save button.

  4. From the ”Save As” dialog box, select the path (such as the Desktop) where to store the new PDF, enter the file name, and then click on Save.
  5. Now, open the new PDF document and it won't be password protected so that you can easily edit, print, and making changes to it.

Method 3: Remove PDF Permissions Password with Third-Party Software

The above methods only work if you can remember the PDF permissions password. If you've completely forgotten it, you have to make use of third-party software to remove the security restrictions. Password Recovery Bundle is all-in-one password cracking utility that lets you recover the document open password, as well as removing permissions password of your PDF file.

  1. Launch the Password Recovery Bundle software. Click the "Recover From File" button located at the right side and select the "PDF Password" option.

  2. Select the password-protected PDF file from the dialog box and hit Open.

  3. Next, choose the "Remove Owner Password" radio button and click Next.

  4. The program will create a duplicate copy of the original PDF document, and that duplicate copy is unlocked and all the editing/copying/printing restrictions has been removed.

  5. When you open the duplicate PDF document with Adobe Acrobat Reader or your browser, it would no longer be asking you a permissions password.

After successfully unlocking and removing your PDF permissions password, you're free to copy content or extract images from the unprotected PDF file and also edit/print without any restriction.

சனி, 3 ஏப்ரல், 2021

How To Record TeamViewer Session

 

How To Record TeamViewer Session

TeamViewer, the much loved software for screen-sharing and remote desktop control supports recording sessions. Record session is one of the new features available in TeamViewer (introduced with version 7.0) which lets you record a live session with a simple mouse click.

The Record Session feature not only enables you record a session but also lets you convert the recorded video file to the popular AVI format. By default, TeamViewer saves the recordings in .tvs format. Another advantage of this feature is that the recoded session can be played within TeamViewer software without the help of any third-party media players.

Steps to record TeamViewer session

Step 1: Launch TeamViewer and get access to a remote machine.

Step 2: When the session is in progress, click Extras > Record > Start button to begin recording the session. Once done, click Stop button (go to Extras > Record > Stop) to end the recording and save the file in a desired location. As we mentioned earlier, TeamViewer saves the video file in .tvs format.

Record Session In TeamViewer Picture2 Record Session In TeamViewer

To convert the video file from .tvs to .avi format follow the next two steps:

Step 1: Run TeamViewer software. In the main screen, click Extras > Play or convert recorded session option to browse to the location of the recorded file. Select the video file and click Open button.

Record Session In TeamViewer Picture4

Step 2: Once the video file starts playing in TeamViewer, click Convert button to see options to select the target file location. Here, you will also see options to select the codec type and resolution for the AVI video file. If you are not sure which codec and resolution to choose, go ahead with default settings.

Record Session In TeamViewer Picture5

Record Session In TeamViewer Picture6

Once done, click Convert button to start converting the selected video file from .tvs to .avi format. Depending on the duration of the session, selected codec and resolution the conversion process may take a few minutes to hours.

Record Session In TeamViewer Picture43JPG

The .avi file then can be played in any of the popular media player software.

To automatically record all sessions:

An option is also available to automatically record all your sessions. To enable this feature:

a. Open TeamViewer main screen.

b. Navigate to ExtrasOptions  and then Remote Control.

c. Enable Auto record remote control sessions option.

Record Session In TeamViewer Picture7

வெள்ளி, 26 மார்ச், 2021

Create a Fixed Sidebar

 <!DOCTYPE html>

<html>

<head>

<meta name="viewport" content="width=device-width, initial-scale=1">

<style>

body {

  font-family: "Lato", sans-serif;

}


.sidenav {

  width: 130px;

  position: fixed;

  z-index: 1;

  top: 20px;

  left: 10px;

  background: #eee;

  overflow-x: hidden;

  padding: 8px 0;

}


.sidenav a {

  padding: 6px 8px 6px 16px;

  text-decoration: none;

  font-size: 25px;

  color: #2196F3;

  display: block;

}


.sidenav a:hover {

  color: #064579;

}


.main {

  margin-left: 140px; /* Same width as the sidebar + left position in px */

  font-size: 28px; /* Increased text to enable scrolling */

  padding: 0px 10px;

}


@media screen and (max-height: 450px) {

  .sidenav {padding-top: 15px;}

  .sidenav a {font-size: 18px;}

}

</style>

</head>

<body>


<div class="sidenav">

  <a href="#about">About</a>

  <a href="#services">Services</a>

  <a href="#clients">Clients</a>

  <a href="#contact">Contact</a>

</div>


<div class="main">

  <h2>Auto Sidebar</h2>

  <p>This sidebar is as tall as its content (the links), and is always shown.</p>

  <p>Scroll down the page to see the result.</p>

  <p>Some text to enable scrolling.. Lorem ipsum dolor sit amet, illum definitiones no quo, maluisset concludaturque et eum, altera fabulas ut quo. Atqui causae gloriatur ius te, id agam omnis evertitur eum. Affert laboramus repudiandae nec et. Inciderint efficiantur his ad. Eum no molestiae voluptatibus.</p>

  <p>Some text to enable scrolling.. Lorem ipsum dolor sit amet, illum definitiones no quo, maluisset concludaturque et eum, altera fabulas ut quo. Atqui causae gloriatur ius te, id agam omnis evertitur eum. Affert laboramus repudiandae nec et. Inciderint efficiantur his ad. Eum no molestiae voluptatibus.</p>

  <p>Some text to enable scrolling.. Lorem ipsum dolor sit amet, illum definitiones no quo, maluisset concludaturque et eum, altera fabulas ut quo. Atqui causae gloriatur ius te, id agam omnis evertitur eum. Affert laboramus repudiandae nec et. Inciderint efficiantur his ad. Eum no molestiae voluptatibus.</p>

  <p>Some text to enable scrolling.. Lorem ipsum dolor sit amet, illum definitiones no quo, maluisset concludaturque et eum, altera fabulas ut quo. Atqui causae gloriatur ius te, id agam omnis evertitur eum. Affert laboramus repudiandae nec et. Inciderint efficiantur his ad. Eum no molestiae voluptatibus.</p>

</div>  


</body>

</html> 



Auto Sidebar

This sidebar is as tall as its content (the links), and is always shown.

Scroll down the page to see the result.

Some text to enable scrolling.. Lorem ipsum dolor sit amet, illum definitiones no quo, maluisset concludaturque et eum, altera fabulas ut quo. Atqui causae gloriatur ius te, id agam omnis evertitur eum. Affert laboramus repudiandae nec et. Inciderint efficiantur his ad. Eum no molestiae voluptatibus.

Some text to enable scrolling.. Lorem ipsum dolor sit amet, illum definitiones no quo, maluisset concludaturque et eum, altera fabulas ut quo. Atqui causae gloriatur ius te, id agam omnis evertitur eum. Affert laboramus repudiandae nec et. Inciderint efficiantur his ad. Eum no molestiae voluptatibus.

Some text to enable scrolling.. Lorem ipsum dolor sit amet, illum definitiones no quo, maluisset concludaturque et eum, altera fabulas ut quo. Atqui causae gloriatur ius te, id agam omnis evertitur eum. Affert laboramus repudiandae nec et. Inciderint efficiantur his ad. Eum no molestiae voluptatibus.

Some text to enable scrolling.. Lorem ipsum dolor sit amet, illum definitiones no quo, maluisset concludaturque et eum, altera fabulas ut quo. Atqui causae gloriatur ius te, id agam omnis evertitur eum. Affert laboramus repudiandae nec et. Inciderint efficiantur his ad. Eum no molestiae voluptatibus.

சனி, 5 டிசம்பர், 2020

Get the List of File Names from a Folder in Excel (with and without VBA)

 

Get the List of File Names from a Folder in Excel (with and without VBA)

On my first day in my job in a small consulting firm, I was staffed on a short project for three days.

The work was simple.

There were many folders on the network drive and each folder had hundreds of files in it.

I had to follow these three steps:

  1. Select the file and copy its name.
  2. Paste that name in a cell in Excel and hit Enter.
  3. Move to the next file and repeat step 1 & 2.

Sounds simple right?

It was – Simple and a huge waste of time.

What took me three days could have been done in a few minutes if I knew the right techniques.

In this tutorial, I will show you different ways to make this entire process super fast and super easy (with and without VBA).

Limitations of the methods shown in this tutorial: With the techniques shown below, you will only be able to get the names of the files within the main folder. You will not get the names of the files in the sub-folders within the main folder. Here is a way to get names of files from folders and sub-folders using Power Query

Using FILES Function to Get a List of File Names from a Folder

Heard of FILES function before?

Don’t worry if you haven’t.

It is from the childhood days of Excel spreadsheets (a version 4 formula).

While this formula does not work in the worksheet cells, it still works in named ranges. We will use this fact to get the list of file names from a specified folder.

Now, suppose you have a folder with the name – ‘Test Folder‘ on the desktop, and you want to get a list of file names for all the files in this folder.

Here are the steps that will give you the file names from this folder:

  1. In cell A1, enter the folder complete address followed by an asterisk sign (*)
    • For example, if your folder in the C drive, then the address would look like
      C:\Users\Sumit\Desktop\Test Folder\*Folder address in a cell
    • If you are not sure how to get the folder address, use the following method:
        • In the folder from which you want to get the file names, either create a new Excel Workbook or open an existing workbook in the folder and use the below formula in any cell. This formula will give you the folder address and adds an asterisks sign (*) at the end. Now you can copy-paste (paste as value) this address in any cell (A1 in this example) in the workbook in which you want the file names.
          =REPLACE(CELL("filename"),FIND("[",CELL("filename")),LEN(CELL("filename")),"*")
          [If you have created a new workbook in the folder to use the above formula and get the folder address, you may want to delete it so that it doesn’t feature in the list of files in that folder]
  2. Go to the ‘Formulas’ tab and click on the ‘Define Name’ option.File Names from a Folder in Excel - Define Name
  3. In the New Name dialogue box, use the following details
    • Name: FileNameList (feel free to choose whatever name you like)
    • Scope: Workbook
    • Refers to: =FILES(Sheet1!$A$1)File Names from a Folder in Excel - Define Name Refres to
  4. Now to get the list of files, we will use the named range within an INDEX function. Go to cell A3 (or any cell where you want the list of names to start) and enter the following formula:
    =IFERROR(INDEX(FileNameList,ROW()-2),"")
  5. Drag this down and it will give you a list of all the file names in the folder

Getting the File Names from a folder using the FILES function Excel

Want to Extract Files with a Specific Extension??

If you want to get all the files with a particular extension, just change the asterisk with that file extension. For example, if you want only excel files, you can use *xls* instead of *

So the folder address that you need to use would be C:\Users\Sumit\Desktop\Test Folder\*xls*

Similarly, for word document files, use *doc*

How does this work?

FILES formula retrieves the names of all the files of the specified extension in the specified folder.

In the INDEX formula, we have given the file names as the array and we return the 1st, 2nd, 3rd file names and so on using the ROW function.

Note that I have used ROW()-2, as we started from the third row onwards. So ROW()-2 would be 1 for the first instance, 2 for the second instance when the row number is 4, and so on and so forth.

Watch Video – Get List of File Names from a Folder in Excel

Using VBA Get a List of All the File Names from a Folder

Now, I must say that the above method is a bit complex (with a number of steps).

It’s, however, a lot better than doing this manually.

But if you’re comfortable with using VBA (or if you’re good at following exact steps that I am going to list below), you can create a custom function (UDF) that can easily get you the names of all the files.

The benefit of using a User Defined Function (UDF) is that you can save the function in a personal macro workbook and reuse it easily without repeating the steps again and again. You can also create an add-in and share this function with others.

Now let me first give you the VBA code that will create a function to get the list of all the file names from a folder in Excel.

Function GetFileNames(ByVal FolderPath As String) As Variant
Dim Result As Variant
Dim i As Integer
Dim MyFile As Object
Dim MyFSO As Object
Dim MyFolder As Object
Dim MyFiles As Object
Set MyFSO = CreateObject("Scripting.FileSystemObject")
Set MyFolder = MyFSO.GetFolder(FolderPath)
Set MyFiles = MyFolder.Files
ReDim Result(1 To MyFiles.Count)
i = 1
For Each MyFile In MyFiles
Result(i) = MyFile.Name
i = i + 1
Next MyFile
GetFileNames = Result
End Function

The above code will create a function GetFileNames that can be used in the worksheets (just like regular functions).

Where to put this code?

Follow the steps below to copy this code in the VB Editor.

  • Go to the Developer tab.Developer tab in the ribbon
  • Click on the Visual Basic button. This will open the VB Editor.Visual Basic button in the ribbon
  • In the VB Editor, right-click on any of the objects of the workbook you’re working in, go to Insert and click on Module. If you don’t see the Project Explorer, use the keyboard shortcut Control + R (hold the control key and press the ‘R’ key).insert Module in VB Editor
  • Double click on the Module object and copy and paste the above code into the module code window.Copy code in module to get the file list name from a folder

How to Use this Function?

Below are the steps to use this function in a worksheet:

  • In any cell, enter the folder address of the folder from which you want to list the file names.
  • In the cell where you want the list, enter the following formula (I am entering it in cell A3):
    =IFERROR(INDEX(GetFileNames($A$1),ROW()-2),"")
  • Copy and paste the formula in the cells below to get a list of all the files.

Get List of File Names from Folder using VBA function

Note that I entered the folder location in a cell and then used that cell in the GetFileNames formula. You can also hard code the folder address in the formula as shown below:

=IFERROR(INDEX(GetFileNames("C:\Users\Sumit\Desktop\Test Folder"),ROW()-2),"")

In the above formula, we have used ROW()-2 and we started from the third row onwards. This made sure that as I copy the formula in the cells below, it will get incremented by 1. In case you’re entering the formula in the first row of a column, you can simply use ROW().

How does this formula work?

The GetFileNames formula returns an array that holds the names of all the files in the folder.

The INDEX function is used to list one file name per cell, starting from the first one.

IFERROR function is used to return blank instead of the #REF! error which is shown when a formula is copied in a cell but there are no more file names to list.

Using VBA Get a List of All the File Names with a Specific Extension

The above formula works great when you want to get a list of all the file names from a folder in Excel.

But what if you want to get the names of only the video files, or only the Excel files, or only the file names that contain a specific keyword.

In that case, you can use a slightly different function.

Below is the code that will allow you get all the file names with a specific keyword in it (or of a specific extension).

Function GetFileNamesbyExt(ByVal FolderPath As String, FileExt As String) As Variant
Dim Result As Variant
Dim i As Integer
Dim MyFile As Object
Dim MyFSO As Object
Dim MyFolder As Object
Dim MyFiles As Object
Set MyFSO = CreateObject("Scripting.FileSystemObject")
Set MyFolder = MyFSO.GetFolder(FolderPath)
Set MyFiles = MyFolder.Files
ReDim Result(1 To MyFiles.Count)
i = 1
For Each MyFile In MyFiles
If InStr(1, MyFile.Name, FileExt) <> 0 Then
Result(i) = MyFile.Name
i = i + 1
End If
Next MyFile
ReDim Preserve Result(1 To i - 1)
GetFileNamesbyExt = Result
End Function

The above code will create a function ‘GetFileNamesbyExt‘ that can be used in the worksheets (just like regular functions).

This function takes two arguments – the folder location and the extension keyword. It returns an array of file names that match the given extension. If no extension or keyword is specified, it will return all the file names in the specified folder.

Syntax: =GetFileNamesbyExt(“Folder Location”,”Extension”)

Where to put this code?

Follow the steps below to copy this code in the VB Editor.

  • Go to the Developer tab.
  • Click on the Visual Basic button. This will open the VB Editor.
  • In the VB Editor, right-click on any of the objects of the workbook you’re working in, go to Insert and click on Module. If you don’t see the Project Explorer, use the keyboard shortcut Control + R (hold the control key and press the ‘R’ key).
  • Double click on the Module object and copy and paste the above code into the module code window.

How to Use this Function?

Below are the steps to use this function in a worksheet:

  • In any cell, enter the folder address of the folder from which you want to list the file names. I have entered this in cell A1.
  • In a cell, enter the extension (or the keyword), for which you want all the file names. I have entered this in cell B1.
  • In the cell where you want the list, enter the following formula (I am entering it in cell A3):
    =IFERROR(INDEX(GetFileNamesbyExt($A$1,$B$1),ROW()-2),"")
  • Copy and paste the formula in the cells below to get a list of all the files.

Get File Names from a Folder in Excel by Extension keyword

How about you? Any Excel tricks that you use to make life easy. I would love to learn from you. Share it in the comment section!

You May Also Like the Following Excel Tutorials:

Excel Ebook Subscribe

FREE EXCEL BOOK

Get 51 Excel Tips Ebook to skyrocket your productivity and get work done faster

121 thoughts on “Get the List of File Names from a Folder in Excel (with and without VBA)”

  1. Awesome, Thanks. really helpful….Though i guess this works only for local drive folders. Is there a way to get the sever location work? As, if there are huge amounts of data it’s not wise to copy paste on my local drive and then do this. There should be a way to get the files names from the severs connected. Could you please help me out with that?

  2. 1. select file in folder
    2. hold shit and right click
    3. select “copy as path”
    4. paste in excel
    5. Use find/replace to find “folder path” and replace with ” “

  3. Amazing solutions both with/without VBA.
    It works in my PC but I would like to know why is doesn’t work if the folder is in Onedrive?
    I´m using in cell A1 =REPLACE(CELL(“filename”),FIND(“[“,CELL(“filename”)),LEN(CELL(“filename”)),”MyFolder/”)
    to obtain the folderpath that is in One drive and in B1=INDEX(GetFileNames(A1,1),””)

  4. Super bro! worked out correctly for me (using the Excel formula). Many thanks for sharing your knowledge.

  5. Very well. I like the code of vba. But i think you have some issue with ReDim Result(1 To MyFiles.Count) and with the ReDim Preserve Result(1 To i – 1). Because i run the code and 1 of files i can’t see.
    I think the best to change
    ReDim Result(0 To MyFiles.Count)
    ReDim Preserve Result(0 To i – 1).
    And after this all works.
    Thanks for great job.

  6. Awesome!!! Thanks a lot, man! Got it done, what I needed to, following your video. Kudos to you!

  7. Is there a way to select file names based on their created date or last modified date? For example, I want files created in the last 24 hrs, 36 hrs, and 5 days?

  8. Hi, this is great, but I need a list of the file names without their extension.. how to do this in one step?

    • You can use below formula

      =IFERROR(LEFT(INDEX(FileNameList,ROW()-2),FIND(“.”,INDEX(FileNameList,ROW()-2))-1),””)

  9. if one of the file in the folder delete this program can not update that and old file name remain in the list

  10. I find it faster to stick the folder path into a browser and then copy and paste into excel.
    But yes, even better when excel is set up to extract the data with a click of the button.

  11. Hi, what i like to know is….
    i have a cell A1 in sheet1, and i like to output the highest file number of a folder in that cell.
    So when the folder name = userinvoice and the file name in pdf and xlsm is for example 20190001.pdf range 20190199 and 20190001.xlsm to 20190199 i like to display the value of the highest number in that folder to cell A1 in sheet1. In this example it would be 20190199.pdf and 20190199.xlsm

    Thank you very much for you effort.

  12. hi

    thankyou for the post

    I need a macro which can automate the work of renaming the pdf with amount within the pdf, instead of depending on a software

  13. I want to see Respective File Name with Save Time & Date…
    Please help for the Macro Code for the same.

  14. I see the method for only listing specific extensions but is there a way to exclude extensions?

  15. I need to get at the place to make a file name and go where I took pictures at yesterday

  16. Amazing ! i’m mind blown here,
    I knew of to do it with marco but with a simple formula! wonderful!

  17. hoping someone could help, hoping I could automate my excel list using VBA or other procedure,

    For A, the idea is I have a PDF file, let say rev. 1,2,3,4 etc, and I will put it in one folder, what I need is I need to capture the latest revision with hyperlink using formula.

    For B, the idea is almost same as above except for one revision, let say rev. 01 and I will put it in one folder (same folder as formula A), what I need is I need to capture the exact revision with hyperlink using formula.

    I get this this formula but i don’t know how it will work- thanks in advance.

    A) Formula for latest “rev number” column

    =IF(Bfile(“Z:3 M+ MWC3.1 M+_RSSM+ (CC_2015_3A_022)3_DrawingsUSBM+ WS4_Drawings”&MIDB($A50,11,3)&”PDF”&MIDB($A50,1,35)&”-“&LOOKUP(1,0/($K50:$DF50” “),$K50:$DF50)&”.PDF”),HYPERLINK(“Z:3 M+ MWC3.1 M+_RSSM+ (CC_2015_3A_022)3_DrawingsUSBM+ WS4_Drawings”&MIDB($A50,11,3)&”PDF”&MIDB($A50,1,35)&”-“&LOOKUP(1,0/($K50:$DF50” “),$K50:$DF50)&”.PDF”,LOOKUP(1,0/($K50:$DF50″ “),$K50:$DF50)),”*”&LOOKUP(1,0/($K50:$DF50” “),$K50:$DF50))

    B) Formula for latest “rev number individual” column

    =IF(Bfile(“Z:3 M+ MWC3.1 M+_RSSM+ (CC_2015_3A_022)3_DrawingsUSBM+ WS4_Drawings”&MIDB($A52,11,3)&”PDF”&MIDB($A52,1,35)&”-00.PDF”),HYPERLINK(“Z:3 M+ MWC3.1 M+_RSSM+ (CC_2015_3A_022)3_DrawingsUSBM+ WS4_Drawings”&MIDB($A52,11,3)&”PDF”&MIDB($A52,1,35)&”-00.PDF”,”00″),”*00″)

  18. I only tried the first method and it works perfectly for me… thank you so much for saving me days of boring inputing!!

  19. Umm its not working on MAC 🙁
    The formula you’ve provided (in column A) gives me this:
    /Volumes/Data/Reports/*

    So the INDEX formula (in column B) gives #N/A
    🙁

    • Remove the first “/” (the one before Volumes) and change the rest of the slashes to colons.

  20. I used the code above to obtain a list of files. The files names are as below:
    Diesel___1234567___NIR_cuvette___20180912_234811.0
    Diesel___1234567___NIR_cuvette___20180912_235510.0
    The code only pulls the first file for each sample and fails to list the second (or third file). Is there a way to correct for this? Thanks.

  21. Hey,
    I have a ecxel sheet which have some product names, and also have a folder which have some pdf files named same as in cell data, like if cell A2 value is apple1, Pdf file name is apple1.pdf, i want to know which name file is missing, can we get that in excel somwhow..

  22. Hi Sumit,

    I want to list the names and duration of all videos in a folder and its subfolders using Excel VBA. From the code below I can get the duration of video files, but I can’t exclude all other files. This gives me a list of all the file names, which I don’t need. Also I am failing to loop through subfolders.
    What I want to achieve is for the macro to loop through all subfolders in the the given root folder and list only video names and duration in columns A and B.
    Some help with this is truly appreciated.
    Option Explicit

    Dim i As Long, SourceFldr
    Dim c As Range, rng As Range
    Dim sFile As Variant
    Dim oWSHShell As Object
    Dim WS As Worksheet
    Dim lRow As Long

    Sub GetDuration()

    Dim fldr As FileDialog
    Set fldr = Application.FileDialog(msoFileDialogFolderPicker)
    Set oWSHShell = CreateObject(“WScript.Shell”)

    With fldr
    .Title = “Select a Source Folder”
    .AllowMultiSelect = False
    .InitialFileName = oWSHShell.SpecialFolders(“Desktop”)
    If .Show -1 Then GoTo NextCode
    SourceFldr = .SelectedItems(1)
    NextCode:
    End With

    Dim oShell: Set oShell = CreateObject(“Shell.Application”)
    Dim oDir: Set oDir = oShell.Namespace(SourceFldr)

    i = ActiveSheet.Range(“A” & Rows.Count).End(xlUp).Row + 1

    For Each sFile In oDir.Items
    Cells(i, 1).Value = oDir.GetDetailsOf(sFile, 0) ‘File Name
    Cells(i, 2).Value = oDir.GetDetailsOf(sFile, 27) ‘File Lenght
    i = i + 1
    Next sFile

    Set oDir = Nothing
    Set oShell = Nothing

    End Sub

  23. Hey! Sumit Bansal right? As a matter of fact you are my excel HERO. I’ve been following your blog for quite a while now and everything you thought was amazing. Even though I’m still a student, I know one day this knowledge is going to save me a lot of time. I thought I was an excel expert with my one semester training So I created a blog to publish my skills on (http://excel-programming.com). But upon discovering your skills and experience I think I still have a a long way to go. Thank you very much for this blog.

  24. You are doing wonderful work Sumit to educate Excel users. God bless you.
    Please try the Excel Addin called ASAP Utilities by downloading it. There is a free (Home&Student) and paid version. File listing in Excel sheet of any directory and nested sub directories, with many properties of the files is so easy with many menu driven options (Menu-File & System-Item 24) This is just one of more than 300 utilities. It will be very useful for all Excel users and saves tons of time and effort. Current version is 7.4 and the link to the site is http://www.asap-utilities.com/ . I do not have any pesronel intrest in the product except to make it known to many Excel users to benifit in their work. It was developed by Bastien Mensink from Netherlands way back in 1999. I am using it since that time. Feed back on your experience is appreciated.

  25. Sumit this one deserves a kudos!!

    Some time back i was working on its VBA and m non VBA guy……….

  26. I was also wondering if there is a way to extract additional properties information at the same time
    ie
    “File Name”
    “Created”
    “Owner”
    “Author”
    “Title”
    “Comments”
    “Tags”

  27. Hmm, nowadays I would go with a Power Query ( Get and Transform) solution. Read from folder, and delete all columns except file name. Save and load to table. No macro, no formula involved.

  28. Since it has not been corrected I assume that it has not been reported yet. The first version of this formula: =IFERROR(INDEX(FileNameList,ROW()-2,””) should actually be: =IFERROR(INDEX(FileNameList,ROW()-2),””). The trick won’t work until the right formula is used.

  29. Hi Sumit, Great trick. Thanks a lot. However I was wondering if there is a way to extract the file path as well along with the file name

  30. I copied everything exactly but my cells are blank in the B column and it doesn’t populate the file names. any reason why? Also I’m using office 2010.

    • I figured out the issue, i didn’t have a slash before the asterisk * at the end. But I have one more question. Can this be used to get a value from a cell in these docs as well? e.g. I get a list of all docs in a given folder, can I then get a value from a cell in each of those docs if its all the same cell in each doc?

  31. Hi
    Was wondering if there is a way to extract properties information at the same time
    ie
    “File Name”
    “Created”
    “Owner”
    “Author”
    “Title”
    “Comments”
    “Tags”

    Much appreciated

  32. Hi Sumit, great tutorial. I used this because files are constantly being added to a specific folder. This allows for the names of those new folders to show. Since I do not know the names of the new files that will be created I was hoping to then use the results of this in an external reference formula. Do you know if this is possible?

  33. One method I have used before uses the command prompt. Navigate to the folder you want to extract file names from. Type (dir /b > “sample.txt”) minus the parenthesis. This will create a text file in the same directory that you can then open in Excel for further processing.

  34. dear sir,
    how can i Get a List of File Names from a Folder in Excel without extension like . jpg, .pdf

  35. Amazing! Thanks for this Great Trick!!!

    Question: When the New File Names come in, they Start Over from the Top-Shifting File Names Down, how can I get them to come in at the bottom of the list (based on date/time modified)?

    Make File Name Hyperlink? If I Select the Column with your Formula, Insert Hyperlink and Add Folder Location, this links them to the folder, but how can I make it open the file directly? Also If you can Help: I have a Folder Filled with Email Messages (.msg Files) that I am keeping a Running List of in Excel and have to manually enter data from each Email such as Name (Email Address before @) + Company (Email Address after @), Date Received etc. – Is there a way to Auto Populate this information into Excel from the .msg File following the Automated File Name you have created here?

  36. I have a single folder with multiple sub-folders each with multiple files, can I extract at the highest folder level?

  37. Hi, Is there a way i can get the time the file is created in addition to the file name?

  38. Hei Sumit. I got Folder name in A1. But INDEX will not work properly, I get only #N/A, (I define A1 as “NM”)
    Can you plz look at screenshot and give me some guide lines that where i do wrong?
    And my required folder is on Sharepoint.

  39. I tried Getting a List of File Names from a Folder in Excel. Why did I get #NAME? instead of the name of the first file? I like your video lesson. Thank you.
    Husen Kabeer, myaquadome@yahoo.com

    c:This PCDocumentsHusen Data Files – 2014Word*
    =INDEX(FileNameList,1)
    #NAME?

  40. Sumit, is there a way for this formula to look within a series of sub-folders for the same results.

  41. if this done with a folder that gets updated a lot, will this auto update with the new file names or will you have to start all over

    • It would automatically update if you open the workbook or you press F9 (to force a calculation), or even if you make any change in the worksheet.

      • Hello Sumit, thank you for your post. Made my life easier. Never the less I still have a problem with the update. It does not update automatically. I have to drag the formula again each time I open the document, or either double click the cell to updated itself. Do you know what I might do wrong? For your information I used your formula in combination with other formulas as bellow :

        =LEFT($B$3;LEN($B$3)-1)&IFERROR(INDEX(FileList0916;ROWS($B$4:B33));””)

    • Hello Brenda. You have created a named range with the name “ExcelList”, while the formula uses “FileNameList”. Change the formula to =IFERROR(INDEX(ExcelList,ROWS($B$1:B1)),””)

        • Are you using the formula to get the folder address. Use this formula =REPLACE(CELL(“filename”),FIND(“[“,CELL(“filename”)),LEN(CELL(“filename”)),”*”)

          It shouldn’t look something as shown in your spreadsheet. Also, make sure the excel file (in which you are extracting the file names) is saved in the same folder.

          • Morning,
            At it again this am. Losing my mind. Want this so bad and I just can’t get it to work. Tried everything. Must be something really small and stupid hanging me up. Heading to work. Little bit OCD – lol. I will get back at it when I get home but not too optimistic.

  42. Hi
    The function of FILES does not exist in my version of excel 2010! May be it originated from some Add-Ins?

  43. That is an awesome way. Thanks a lot!!…
    Also, is there a way to get the list of all the folders,subfolders and filenames along with file size and modification date columns.

  44. Another way to get the directory.
    Portuguese version of formula =INFORMAÇÃO(“DIRECTÓRIO”)
    I guess in English will be =INFO(“DIRECTORY”)
    Even easier!

  45. Hi Sumit, thanks a lot for that.. is there any way I can also get the tabs within each excel file that I am looking up in a drive to populate in the columns next to file names? Please let me know it will be really helpful

      • HI Sumit, thanks for the quick response. is there anyway you can help with that code? I have been trying to search for it online but nothing seems to pop up.

  46. Never seen this trick before. Great stuff.

    i think this formula should also work for retrieving the file path, looks shorter 🙂
    =LEFT(CELL(“filename”),FIND(“[“,CELL(“filename”))-1)&”*”

  47. I was able to follow your instructions, but when i save it and go back it isnt there it just has name#. I am not familiar with Macros and it ask me to save Macros-Free and when I do my list isnt there. how can I save it. apologize in advance.

    • Hi Elisa.. Thanks for commenting. Try and save your file as a macro-enabled workbook (with .xlsm extension) and it would work. Since FILES is an old macro formula, it requires the workbook to be saved in .XLSM format. And don’t worry about not knowing macros, it would still work

  48. Awesome solution thank you! However I could only register 256 files (rows). After that I get #¡REF!. Do you know a way to make it work for larger number of files. I need it for 2.000 files aprox. Thank you again. Jacobo

    • Thanks for commenting.. Could you share the sample file you are using. Since FILES is an old formula it may have some limitations, need to check on it.

  49. Once I wanted to do the same so I wrote an Excel Add-in for doing that.

    It can get filenames, folders, file extensions and other information regarding files.

    This tool can write up to excel limit number of rows in just a few minutes.

    In a stress test I did, I got more than 1,000,000 file names in just about 3 minutes.

    Here is a link to try:

    http://excel.gegprifti.com

  50. Dear Sumit,
    Suppose i want to do same for folder name than how we can do?

  51. This was a great time saver Sumit, thanks. ? is there a way to make them a hyperlink without going through every single one?
    Thanks

  52. Interesting.

    Before dragging down, we may use

    =COUNTA(FileNameList)

    to get a sense of how far we need to go down.

    btw, another approach in getting the directory for consideration.

    =REPLACE(CELL(“filename”),FIND(“[“,CELL(“filename”)),LEN(CELL(“filename”)),”*”)

Comments are closed.