Excel - exporting as TXT with text position - excel

I have several text files (about 6). All have the following format.
Column (Text position in txt file)
1-4 -> Code
6-72 -> Name
74-78 -> another code
80-81 -> another code
These text files I want to import into excel, so I can sort them after A-Z and inspect the duplicates. After doing so, I must delete a few duplicates and export this to ONE single txt file. This file must be saved in the exact same format as before. Unfortunately I cannot find anything in the Internet regarding this.
Could somebody help me?
Thanks and best regards
Dennis

I found a solution!
First I combine the data in the excel file and manipulate it. After
that I adjust the width of the columns, so no values overlap.
Then I save this as an .prn file.
This .prn file I open in notepad++ and manipulate the column
position with help of SHIFT + ALT + Down to set multiple Cursors.
Now I got my file :-)
Thanks anyway!
Ressources:
Export an Excel Spreadsheet as fixed width text file
Notepad Multiple Cursors

Related

CSV file, not keeping leading zeros, what do do

I have no idea what to do. Please see below. I need to import this file into another system with the leading zeros. These are sample zip codes as well. I have no idea what is going on. It seems to be an excel issue with CSV files. How can I preseve the leading zeros on a CSV file? Thanks for your help. I haven't had this issue before.
XLSX File
POSTAL_CODE_FORMATTED_TEXT and POSTAL_CODE_FORMATTED_Number
07717
Please see CSV file
CSV File
POSTAL_CODE_FORMATTED_TEXT and POSTAL_CODE_FORMATTED_Number
7717
If you would like the edit the column manually you can follow the below steps
Highlight the column
Right click and select format cells
On the "Number" tab go to "Custom"
4: Under where it says "Type:" you can enter the amount of digits you want to appear in the column (ex: 00000)

office 365 excel csv hyperlink not displaying correctly when imported to excel [duplicate]

Can Excel interpret the URLs in my CSV as hyperlinks? If so, how?
You can actually do this and have Excel show a clickable link. Use this format in the CSV file:
=HYPERLINK("URL")
So the CSV would look like:
1,23.4,=HYPERLINK("http://www.google.com")
However, I'm trying to get some links with commas in them to work properly and it doesn't look like there's a way to escape them and still have Excel make the link clickable.
Does anyone know how?
With embedding the hyperlink function you need to watch the quotes. Below is an example of a CSV file created that lists an error and a link to view the documentation on the method that failed. (Bit esoteric but that's what I am working on)
"Details","Failing Method (click to view)"
"Method failed","=HYPERLINK(""http://some_url_with_documentation"",""Method_name"")"
I read all of these answers and some others but it still took a while to work it out in Excel 2014.
The result in the csv should look like this
"=HYPERLINK(""http://www.Google.com"",""Google"")"
Note: If you are trying to set this from MSSQL server then
'"=HYPERLINK(""http://www.' + baseurl + '.com"",""' + baseurl + '"")"' AS url
you can URL Encode your commas inside the URL so the URL is not split across multiple cells.
Just replace commas with %2c
http://www.xyz.com/file,comma.pdf
becomes
=hyperlink("http://www.xyz.com/file%2ccomma.pdf")
Yes, but it's not possible to link them automatically. CSV files are just text files - whatever opens and reads them is responsible for allowing you to click the link.
As to how Excel seems to handle CSV files - everything between commas is interpreted as if it already had been typed into the cell. Therefore, the CSV file containing ="http://google.com",=A1 will display as http://google.com,http://google.com in Excel. It's important to note, however, that hyperlinks in Excel are metadata, and not the result of anything in the actual cell (ie, a hyperlinked cell to Google still contains http://google.com not <a>http://google.com</a> or anything of that sort.)
Since that's the case, and all metadata is lost when converting to a CSV, it's impossible to tell Excel you wish for something to be hyperlinked merely by changing the cell value. Normally, Excel interprets your input when you hit 'Enter' and links URLs then, but since CSV data is not being entered, but rather already exists, this does not happen.
Your best bet is to write some sort of addon or macro to run when you open up a CSV which parses every cell and hyperlinks them if they match a URL format.
Use this format:
=HYPERLINK(""<URL>"";""<LABEL>"")
e.g.:
=HYPERLINK(""http://stackoverflow.com"";""I love stackoverflow!"")
P.S. The same format works in LibreOffice Calc as well.
"=HYPERLINK(\"\" " + "http://www.mywebsite.com"+ "\"\")"
use this format before writing to CSV.
As described above, "=HYPERLINK(""http://www.google.com"", ""Google"")" is what worked for me.
However, In Excel Version 2204 Click to Run, I couldn't have leading white space.
For example;
FirstName, "=HYPERLINK(""http://www.google.com"", ""Google"")" fails
FirstName,"=HYPERLINK(""http://www.google.com"", ""Google"")" success
The issue here for me was that because a .CSV by it's nature is Comma separated, any commas in the text file are interpreted as separators. It worked for me by using tab characters as separators, saving it as a .TXT file so that when opened in EXCEL you choose the TAB character rather than ','.
In the text file …
## ensure that the file is TAB separated
Item 1 A file Name data.txt
Item 2 Col 2 =HYPERLINK("http:\www.ilexuk.com","ILEX")
"ILEX" then is shown in the cell and "http:\www.ilexuk.com" is the hyperlink for the cell.

CSV Files and Formatting to open in Excel

I have a CSV file but unfortunately, for some of the columns which have a comma in them, they have not enclosed it within double quotes, so when I open the CSV file some rows are all off by one column.
Is there a way that I can identify these rows and format them correctly so that I can open them. I am happy with a non-coding solution or even a coding solution.
Note: The column width cannot be used as they are all varying column width and no way to identify them distinctly.
Any help is appreciated!
Screenshot #1:
This is the CSV file. As you can see, the second row has a comma but doesn't have any double quotes around it. As a result, when I open this file in Excel, the following happens.
Screenshot #2:
So, the question is - How can I modify the file and then open it so that the right data is under the right column as shown below.
Screenshot #3: Desired Output

Add a zero to a zip code in a csv file?

Is there a quick way to append a zero to some highlighted cells in my csv file so I don't have to go one by one?
Should be 01234
Instead it is showing 1234
Since all the zip codes are different I cant just do a simple find and replace. TY
You can do that using cell formatting option Zip Code.
Select the column/cells containing zip codes.
Right click -> Format Cells
Number tab -> Special category
And select Zip Code type.
You can:
Open the csv in excel
Insert a mask at ZipCode column using =TEXT(A1, "00000")
Save as csv, ignoring the fact that you'll loose the formulas (this will preserve the results in the csv file)

How do I create a fixed width text file?

I have a fixed width text file that I needed to edit about 200 rows of. Importing into excel is easy but when I have completed my edits and try to save the file as a space-delimited or text file all the spacing goes out of whack, i.e the first field in excel is padded out to 6 characters but when I save the file as space-delimited or text it then turns that field into 8 characters.
Please note that I'm using a LEFT(text&REPT(" ", 30)30) formula to get the required padding which works very nicely. However I can't seem to save the file with the correct number of spaces. I have also just tried copying and pasting into a notepad file but this seems to just create more unwanted spaces etc.
How do I create a fixed width file when I have all the data I need and the field length requirements?? Has anyone had this trouble before? Thanks in advance.
I agree with Gary's Student. Just go to: Save As -> Formatted Text (Space Delimited) (.prn)*.This will bring almost same functionality as one you have in Excel.
For more information you may refer to:
https://superuser.com/questions/100433/export-an-excel-spreadsheet-to-fixed-width-text-file
I found that the best way to do this was to use Access and save as a text file and then you can set your own field width and export. excellent!
I'll suggest an export to csv (or similar) and then convert it with UltraEdit's super simple "Convert CSV to fixed with" function.
It scans the file and suggests a column width based on you content.
You can easily define your own preferred column width in a 30,25,25,40 pattern.
There's a 30 day trial, if you like it it's well worth the $99 license...

Resources