Excel 2016 - Using Get Data to import CSV and format to show in a different column in the worksheet - formatting

Currently I have a CSV file that I am trying to import into excel using Get Data, and format to show each value separated in a different column within the excel workbook. I have the CSV with the values separated in the file in such a way as seen below:
VBU|"VBU Name"|"PO Number"|"Customer Order Number"|"Line Number"|"Insert Date/Time"|"Ack Date"|"Confirm Date"|"Company Item Number"|"Vendor Model Number"|"Quantity Ordered"|"Line Status"|"Back Order Reason"|"Cancel Reason"|"Origin State"|"Destination State"|"Tracking Number"|"Expected Delivery Date"|"Expected Ship Date"|"Actual Ship Date"
I am having a hard time separating each value into it's separate column in the excel workbook after importing it using the Get Data - From Text/CSV.
Is there a step I am missing like a custom delimiter for instance, in order to have this imported and formatted in such a way that each column shows the individual value (column 1 = VBU, column 2 = VBU Name, Column 3 = PO Number), etc.? This CSV file, all these values are crammed into the first column when I open the CSV in excel 2016.
Any help would be appreciated.

Nevermind, it was an anomally in one file. Using Get Data -> From File -> From Text/CSV and setting delimiter as | did the trick and I was able to transform it and separate the values into different columns

Related

Export values to specific cell in an excel file (using PDI)

I have in table input result as below:
I would like pass this result to excel file in specific row.
For example number_record I want to write to column J5, amount_ma to column K2 and so on. Can something like this be done in pentaho?
I have prepare a solution for you HERE. Using this solution, you can specifically tell which field you want to insert in which position in Excel. Like in my solution i told to insert field [NUMBER_RECORD to C5, AMOUNT_MA to D7,AMOUNT_WD to B5] Please run transformation "getData.ktr".
Add a new sheet to this Excel file, and output a line with the result to the new sheet. And on the old sheet in the cells you need, add formulas with a link to the first row in the new sheet

In Excel VBA, how can I use IMPORTHTML function and increment the date in the html link

I am importing a lot of data into an Excel file from an HTML page that stores the data on different pages by year, with similar links, except for the year. Is it possible to write a macro with a for loop to import data from every year on one sheet, by incrementing the year in the HTML link? I am currently using:
=IMPORTHTML("http://www.abc1900.com","table",0)
to import the data into the excel sheet. I would like to write this:
=IMPORTHTML("http://www.abc1900.com","table",0)
=IMPORTHTML("http://www.abc1901.com","table",0)
=IMPORTHTML("http://www.abc1902.com","table",0)
etc. I can't quite figure it out without ruining the link. Thanks.
Excel doesn't provide a function called IMPORTHTML so I assume this is a UDF.
Nevertheless with a helper column containing the numbers you can concatenate it as a string:
A B
1900 =IMPORTHTML("http://www.abc" & A:A & ".com","table",0)
=A1+1 =IMPORTHTML("http://www.abc" & A:A & ".com","table",0)
and copy that last row formula down.

Export specific data from a selected cell's row into a CSV file

I have been searching for a solution to this, but it seems like I cannot find it.
So basically, I want to select e.g. H2 and then run the macro.
Then it should copy/paste some specific cells into a new CSV file, e.g. O2 and F2. I also want a fixed value that should always be there, called "No".
The first row of the CSV file should be "UTF-8". The next (2nd row in the CSV) should be some headers that is fixed, just as the UTF-8.
Could a solution be to copy all the relevant data into another sheet with the proper format, and then just export that sheet as a CSV?
Illustration:
"UTF-8"
"Name","ID","Email","Customer"
"H2","O2","F2","No"
Solution ended up being exporting the correct data into another sheet with the proper setup, using the following.
Sheets("Sheet1").Range("XX:XX").Copy Destination:=Sheets("Sheet2").Range("XX")

Columns misaligned when exporting SQL Studio query to .CSV

I am trying to export results of query in SSMS to CSV file. I have a number of different tables, and the Export Wizard has thrown a bunch of mapping errors which I can't figure out, so I am trying to use Save As method by right-clicking the query result window. When I open up the CSV file, a number of rows are incomplete, while others are misaligned, and seemed to have shifted one column. All column headers exported correctly. I cannot figure out how to export the results correctly.
Query is as follows:
SELECT
contract.Description,
contract_type.type,
Destination_City.Name_,
contract.Tour_Summary,
employee.First_Name,
employee.Last_name,
Currency_.Currency_Name,
contract_Items.twin,
contract.Upfront_Room_Comp,
contract.Room_Comp_Number,
contract.Room_Comp,
contract.Start_Date,
contract.End_Date,
contract.Payment_Terms
FROM
Contract,
Contract_items,
Contract_type,
Employee,
Currency_,
Destination_City
WHERE
Contract.Contract_ID=Contract_Items.Contract_ID
and contract_items.Contract_Type_Id=contract_type.Contract_Type_Id
and employee.Employee_Id=Contract.Contracted_By_Employee_Id
and Currency_.Currency_Id=contract.currency_id
and Destination_City.Destination_City_Id=Contract_Items.Destination_City_Id
and contract.Contracted_Date > '01/01/2014'
and Contract_type.type = 'Hotel'
and contract.signed = 1
ORDER BY
employee.First_Name
Try to get result in grid (default action), select whole table and copy to clipboard.
Open new Excel sheet and paste result. If you have a problem with alignment, format all columns as text and then paste.

excel macro to read text file and find matches in cells

I really could use some help
I have two .txt/csv files that I need to read from into my excel file.
In my excel file I have a whole column, each cell containing string of characters and I need to write a script to be able find matches and and copy an adjacent column from that txt file.
An example of a single row on my txt file is shown below:
"AB101AA","AB10 1AA","AB101A","AB10 1A","AB101","AB10 1","AB10","AB10","AB","10",394251,806376,,
"AB101AF","AB10 1AF","ABERDEEN","ABERDEENSHIRE",,"ABERDEEN, CITY OF"
My excel file would have a cell which probably say "AB101AF" and i want the corresponding cell to run through a million rows and find the match and then find the corresponding nth cell on the txt file and return it on the excel spreadsheet example "ABERDEEN, CITY OF".
I know I havent been helpful in explaining the issue. But any help would be appreciated.
Thank you
Depending upon the size of your text file you could import the file using the GetExternalData option in Excel. This would allow you to load your data into a different Sheet and then use a lookup to your data from the main Sheet. Using Match and/or vlookup should help here.
You could also add a workbook connection to the text file and search using the connection.