Solved

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

Posted on 2011-02-16
14
254 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
ID: 34909523
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
ID: 34909528
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
ID: 34909761
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
ID: 34910552
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
ID: 34910587
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
ID: 34911256
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
ID: 34912502
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 22

Expert Comment

by:rspahitz
ID: 34913627
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
ID: 34915011
Apologies, rspahitz!
0
 
LVL 7

Expert Comment

by:andymacf
ID: 34920998
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
ID: 34921060
andymacf,

Thanks.

Presumably you had tried that before using PDFZilla?

Regards,
Brian.
0
 
LVL 7

Expert Comment

by:andymacf
ID: 34921325
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
ID: 34921586
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
ID: 34998986
I'll post another question about scripts to open adobe and copy and paste.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Adding Text that self adjusts in a Cell 8 32
Problem to With line 4 41
Excel sheet question 12 23
Vlookup formula error 15 0
Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
Using Word 2013, I was experiencing some incredible lag when typing.  Here's what worked for me....
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

911 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

23 Experts available now in Live!

Get 1:1 Help Now