Solved

How can I import a text file into excel then format the data easily?

Posted on 2011-02-16
14
251 Views
Last Modified: 2012-08-13
Hello all!

I orginally had a horrible pdf file with a bunch of tables and information on it.  As seen in the standard pdf picture

I then used PDFZilla to convert the pdf to a text file. The output can be seen in sampletext.


Then this is where my problem is...


when ever i try to import the text file into excel, I have lots of trouble to get it to format correctly. I try text to columns but i cant get it to separate the numbers correctly.


I don't care about the column headers, but I do need the row data to be separate so that I can write a macro to extract the data and then copy it to another workboook.


Please help! I hope that I have provided enough explanation.
Standard-Pdf.png
SampleText.txt
0
Comment
Question by:jtovar3
  • 4
  • 3
  • 2
  • +3
14 Comments
 
LVL 3

Expert Comment

by:Richard2k4
Comment Utility
if it was me, I would write a script in Powershell or VB to parse the text and seperate the words from the numbers section...then i would import only the numbers as space delimited.   Insert a blank column and then paste in the word sections
0
 
LVL 22

Expert Comment

by:rspahitz
Comment Utility
Have you looked at the text file that gets created?  There are no separators.
I've seen that a lot when copying pdf files and consider it a problem with the automation mechanism used to examine the document.
Anyway, it seems that your PDFZilla tool is not working on that pdf document.
0
 
LVL 10

Accepted Solution

by:
shahzadbux earned 500 total points
Comment Utility
Agree with rspahitz - no separators means looking at the txt file you cant tell where one number begins and the next starts.

Have you tried to select all in the pdf then copy\paste into excel - anything half useful? could then work with it and pull out the info in an acceptable format..
0
 

Author Comment

by:jtovar3
Comment Utility
actually the copy and paste actually didnt work out too bad... surprisingly.

do you have any tips on writing a script to automatically open a pdf, copy all, then paste into excel?

I also need to work on a code to find specific sets of data then transfer them to a separate spreadsheet, but i think i should separate that into a different question thread
0
 
LVL 10

Expert Comment

by:shahzadbux
Comment Utility
Hmm...only way I know off the top of my head is to use AutoIT, maybe a vb script?

Anyone else have another suggestion?
0
 
LVL 22

Expert Comment

by:rspahitz
Comment Utility
I tried it by adding a pdf reference to VBA and opened the pdf and it was excessively complicated to interpret because of the way pdfs are created.  Much easier to copy/paste by hand.
0
 
LVL 26

Expert Comment

by:redmondb
Comment Utility
rspahitz,

Do you have an OCR program?

For example, I have used ABBYY FineReader a lot for converting PDF's and TIFF's to text. This particular OCR (can't speak for others, obviously) recognises when the text is available uses that, bypassing any actual character recognition.

Regards,
Brian.

0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 22

Expert Comment

by:rspahitz
Comment Utility
B, I don't think that comment was meant for me.  I haven't had an OCR program in about 10 years and really don't use one, but it sounds useful for pdf interpretations.
0
 
LVL 26

Expert Comment

by:redmondb
Comment Utility
Apologies, rspahitz!
0
 
LVL 7

Expert Comment

by:andymacf
Comment Utility
We have the full version of Adobe Acrobat Pro, this allows you to convert the pdf, and then you can copy and paste directly from it to excel/word. Quite a worthwhile tool.
0
 
LVL 26

Expert Comment

by:redmondb
Comment Utility
andymacf,

Thanks.

Presumably you had tried that before using PDFZilla?

Regards,
Brian.
0
 
LVL 7

Expert Comment

by:andymacf
Comment Utility
Brian
I have looked at PDFZilla and I don't think it will work in this scenario.  What jtovar3 needs is something that will convert the pdf to a csv file. I found this, it might work.

1.      Open the desired PDF document in Acrobat Standard or Professional.
2.      Select "Export" under "File" and choose "Text." Some versions of Acrobat include options for "Text (accessible)" and "Text (plain);" choose "Text (accessible)" to preserve basic formatting.
3.      Type the file name for the converted document and click the "Save" button. Acrobat saves text files as tab-delimited files.
4.    Launch the spreadsheet application (such as Microsoft Excel or OpenOffice Calc) and select "Open" under "File" in the top menu bar.
5.      Select the text file created in Step 3 and click the "Open" button to launch an Import Wizard.
6.      Review the pages in the Import Wizard to select how the data is organized in columns and click the "Next" button to navigate through the wizard. For example, select "Delimited" to specify fields and click the option next to "Space" or "Comma" to specify how the fields are separated.
7.      Click the "Finish" button.
8.      Select the "Save As" function (usually under "File" in the top menu bar) and select the file type as "CSV (Comma-Separated Values)." Select "CSV (Windows)" instead of "CSV (MS-DOS)" if this option is displayed.
9.      Click the "Save" button.

http://www.ehow.com/how_5816209_convert-pdf-csv.html
0
 
LVL 26

Expert Comment

by:redmondb
Comment Utility
andymacf,

Please read my last post again - I was querying why he was using PDFZilla when he has Adobe Acrobat Pro!

Cheers,
Brian.
0
 

Author Closing Comment

by:jtovar3
Comment Utility
I'll post another question about scripts to open adobe and copy and paste.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now