Auto-create folders from excel file - c

I want to create about 1000 folder, but I think the best way isn't "Create new folder - rename it". I have a excel file (.xls) with a column full with the preferable names..
eg
names.xls
column 1 = name1, name2, name3 , name4 ,name5 , name6 etc
column 2 = amount1 , amount2, amount 3, amount 4. etc
So I want a folder with a name test, and inside it I want all the folders with the names of column 1.. Is it possible and how that think can be done? I think the best language for this job is C, or not? Is excel file a problem? May I insert the 1st column from xls file to an txt file?

The fastest way to do this might be to this:
Insert a column before column 1 with the command to create a directory (md)
Fill it downwards for all the rows with values in the name column (now the 2nd column)
Copy the two columns to a textfile
Search and remove whitespaces if needed
Save the textfile as .bat or .cmd and execute it in the correct directory
If this is a one time thing writing a program could be overkill, but if you need to do it often go with VBS as suggested above.

Related

How to read a flat file and load it into 2 different SQL tables(different table structure) using SSIS 2019

I have a flat file which doesn't have the header record. The data except the trailing record is like a fixed width flat file with no delimiters.
Data in flat file looks like:
TOM ROLLS
DAVECHILLS
TOTAL2XYZ
Fixed Width data(first 2 lines as shown in the above flat file data)
ColumnName Start position End position
Name 1 4
Last_name 5 9
I want to load the data(till trailing record) in data_table and the trailing record(starting with Total) in another table. The data in the total table should look like
c1 c2
2 XYZ
For the data table, I am currently using "fixed width" and dividing the data into different column and it is working fine. Can you please help to load this last trailing record in a different table(Total table as discussed above)
You have not provided enough data for me to test because I can find several methods to load one row and accomplish what you are asking but those methods not necessarily work with multiple rows depending on the structure of you source data.
On the surface it appears that you simply need to make another flat file connection and define the starting and end position to extract only the data for the second table.

Merging Data from four excel files into a single database file

I have 4 excel files and I wanted to insert the data from these 4 excel files to a single database file in MSSQL.
1st Excel file - 10 rows
2nd Excel file - 20 rows
3rd Excel file - 30 rows
4th Excel file - 40 rows
The table in MSSQL should have 100 rows after the task. Thw column names are similar in all the files.
I have taken
tfileInputExcel1 -> tMap -> tMSSQLOutput
tfileInputExcel2
tfileInputExcel3
tfileInputExcel4
All mapped to the same tMap.
I just don´t know how to Map different input sources to a single tMap. I have been searching on the internet on this but I haven¨t find any relevant for my need. Can anyone here help me out on how to map tMap to a multiple input and output sources.
Try this way:
tFileList (with the appropriate file mask)-tFileInputExcel-tMap-tMSSqlOutput
or if you want just one interaction with the database:
tFileList (with the appropriate file mask)-tFileInputExcel-tMap-tHashOutput
onSubJobOk
tHashInput-tMSSqlOutput
Note the tMap is necessary only if you have to transform the input data

Rows concatenating while copying data from SQL to Excel

My SQL query returns 100 rows. When I copy the result to excel sheet or try to download as CSV, data in one of the columns is getting concatenated and excel shows only 30 rows.
For example my query result shows:
Id Name Expression
1 aa One
2 bb Two
3 cc Three
4 dd Four
The data in excel sheet gets copied as:
Id Name Expression
1 aa One
3 cc Two Three Four
Any help is welcome!
Right click any database on your SQL Server -> Tasks -> Export Data, a wizard will pop up. Select your source SQL Server and Destination as Flat File Destination, you can just put an empty csv file on your drive, select Format, Text qualifier. follow with the wizard. See what you can get.
Since I found out that the problem was created by double quotes, I just separated the rows with double quotes.
So we can separate rows, that is first pick all rows with no quotes and then pick all rows with quotes
or
replace quotes with something else.
Select Id, Name, Case Expression When '"' THEN 'BuggerQuotes' ELSE Expression FROM table1
After copying data to excel sheet, I replaced my BuggerQuotes text with double quotes.

Import a text file by converting repeating groups of lines into columns

My data file looks like
1234567 7654321
TEXT ABOUT STUFF
ON MULTIPLE LINES
NOT SURE HOW MANY
1234567 7654321
TEXT ABOUT STUFF
ON MULTIPLE LINES
NOT SURE HOW MANY
The only thing for certain is a new record starts with 2 sets of numbers that are 7 characters long. The numbers are also on a new line and appear as my sample data above.
I am using SQL Server Express on Windows 8.
Ultimately I need the first group of numbers in a column, 2nd group in another column and the remainder of the text in the 3rd column.
This is the realm of ETL. The SQL Server was of doing this is to use SSIS.

SSIS Creating Two Columns of Data in Flat File?

I'm having a strange problem with SSIS. I'm exporting some data from a database into a flat file. It comes out all fine - except that rather than displaying the data like this:
ID FirstName LastName Age
It comes out like this:
ID FirstName LastName Age ID1 FirstName1 LastName1 Age1
Now, its not repeating the same data (ever), so the data might realistically look like this:
1 John Doe 23 2 Jane Doe 22
Why is it repeating like this?
In a fixed-width destination (even though it's "text") - it's really fixed width records (just in a text representation in the code page of your choice), one after another with nothing in between them. So you need to add a record/row delimiter - in this case CRLF.
If you are in a Flat file destination component and click the new button to crete a destination data adapter right there - the "wizard" gives you four options. The difference between fixed-width and fixed-width with row delimiters is that it just puts a little CRLF column on the end.
It sounds to me like the row delimiter from your file source is wrong. It's reading in two or more rows as one row.
What are the output columns listed on the flat file source? If you see all of those you listed, I would almost guarantee this is the issue.
What is the actual layout of the source file? Is it delimited, fixed width columns, etc?

Resources