Copying data tables from PDF documents into Excel normally provides unsatisfactory results. Learn some workarounds which will save time. This post may how to get an image off of a pdf affiliate links.
PDF files are pretty much the norm for distributing reports these days. They provide a nice easy way to collate documents from different sources for distribution. However, once a document is in a PDF format getting that information back into a usable form is a nightmare. If we try to copy and paste a data table from PDF into Excel it just doesn’t format as expected. The pasted information will be displayed in Excel differently based on how the PDF was created. I would love to offer you the perfect solution to get the PDF data table into Excel, however I don’t believe there is one.
If the paste displays as a picture, then as far as I know, you will need to resort to third-party software which contains OCR. If the paste is either a list of values or a continuous text string, then there are some possible workarounds. One of these should work, providing reasonable results and saving you time. Excel is a software program which is designed to work with tables, whilst Word is designed to work with text.
However, Word is actually better at dealing with PDF tables. You may now have a perfect data table in Excel. Or maybe, which is more likely, you have a table which requires a bit of tweaking. It may not be perfect, but it’s still closer than what you had before. If the paste into Excel is just a list of values in one column we can turn to VBA for a bit of help. The VBA code below which will cycle through the selected data and recreate a table layout. We will need to change the following line so that it is equal to the number of columns in the source table, else the data will be in the wrong columns.
If the paste into Excel is a continuous text string for each line then you can use Excel’s built-in functionality to separate the string into columns. If there are spaces between words in the data this will unfortunately separate each of those words into a different cell. We now have a table in Excel which probably just requires a bit of tweaking. It may not be perfect, but it’s still closer than what we had before. Rather than using the Excel functionality we could use VBA code to achieve the same effect. We can increase the chance of our data formatting correctly by being selective about which parts of the PDF to copy.
We don’t have to select the whole table in the PDF file. Excel, then converting the other columns to Excel. Alt whilst selecting the data in the PDF table. I have even used Adobe’s own PDF to Excel converter, and even that requires a lot of manual adjustments. Therefore, I don’t believe that a perfect solution exists for this problem. But, hopefully one of these workarounds has provided a reasonable solution and has saved you a lot of re-keying time. From stock parts to holiday villas, from employees to logos, there are many reasons you may want to automatically change an image based on a cell value.
Manipulating ranges and cells is one of the most common actions in VBA. You can use the following to either learn from or just to copy and paste into your own code. Most of the data we encounter in Excel, is in the form of a list. The columns may contain different data types, but generally the different lines for data or transactions are listed vertically. The 2nd argument in the VLOOKUP function is the table_array.