Libreoffice export each row to csv - csv

I want to know if it is possible to export each row from ODS file to .csv files.
For example :
column1 column2
row1 name info for the row1
row2 name info for the row2 ... and so on.
I want the exported filename to be the names from column1 and the content to be the info from column2.
Is that possible ?

To get Calc to save as .csv, each set of information needs to be on a separate sheet, not just in separate rows. I do not think it would be convenient to do this, and in any case, that will not automatically save with the correct file names.
However what you are asking can be done by creating a Python or Java macro, or perhaps JavaScript. The macro would need to read each row, and then open a file for writing with the name from column 1.
It is possible with Basic as well, but file handling in Basic is awkward.
For a good macro reference, see Andrew Pitonyak's macro document.

Prepare sheet with 2 columns:
file name
content of the file
Concatenate string "echo>" with file name in the first column
Save this sheet in .CSV format, bat with .BAT extension. In Windows it makes executable file.
Execute this batch file in terminal (command line interface). You should first change to proper directory.
DONE

Related

Karate - Is it possible to use 1st line of data in csv file in one file and the 2nd line of data in another feature file

In my .csv file, I have the list of firstName and lastName. I want to use first entry in one feature file and the 2nd entry in another feature file. Is it possible to do that?
See if this helps: https://github.com/intuit/karate#calling-other-feature-files - note that you can "pass data" to other feature files.
And note that when you read a CSV file, you get JSON: https://github.com/intuit/karate#csv-files
If that does not help - then the answer is - no it is not possible to do that !

Eggplant : how to update a .csv file in senstalk

I am new to eggplant functional. Didn't find any reference to update a csv using eggplant functional.
Reference: http://docs.testplant.com/ePF/using/epf-accessing-data-cell-by-name.htm
You can read files in and out like so, and editing a CSV is the same as other text files.
To read a file into a variable:
put file "/etc/passwd" into passwordInfo
To write a variable to a file:
put "0,0,0,0" into file "/tmp/testing/counters"
What I would do is read in your CSV and copy to a new variable, then output it. There's pretty useful syntax for moving to a specific line in your file. For example, if you wanted to increment the second column of the first row of your file "counters", you could use:
add 1 to item 2 of line 1 of file "/tmp/testing/counters"
All of this and more is in "File and Folder Interaction" provided on the Eggplant website.

Folder Structure In SSIS for Output file and naming convention of Output file

SSIS
This is general question which i am going to ask and might possible to have multiple answer.
Techie, please share with me the best solution if familiar with scenario.
i have 100 customer and they share file for us to load into our database.
and after compution and the output file need to be saved in Output folder.
the name of the output file should be customer_name.txt where customer_name
is coming from a column available in input file.
Can anyone please help me how should i design this in SSIS to achieve my Goal
At first, use a Foreach Loop Container for every file.
For each one, store data into your importTable in database with the fileName or customerName.
Then, when you need to get output file:
Get the nameFile or userName with a query and save it into a ssis variable.
Create your file with the 'DestinationVariable' as 'User::yourVariableName'
Add the data from your database and then use a simple script to move it into output folder
Example

Ms-Access trying to use "transfer text" to create a csv file with a unique filename

I am trying to use an automated macro to export a Ms-Access table to a csv file. I want the destination file to have a unique name, and I reckoned that using now()yyyymmddhhnn would be a good way to achieve this.
I have got transfer text working ok from my macro, and I have set up an export file spec for the transfer.
I am using ="C:\batchfile_" & Format(Now(),"yyyymmddhhnn") & ".csv" in the filename argument in the macro. This bit works.
But when I try to run the macro, it tells me that the filename doesn't exist and then the export doesn't complete. I am not sure why this is, but I think it is because the export file specification is expecting the destination file to have the same filename and column structure as the source table.
Does anyone know a way around this?
Eric
This is very old thread, I am posting my solution so that it may be usefull for some one else
transfer text works fine, as long as variables are supplied properly, you can check for other options other than filename, datasource alternatively create using file open statement
by opening text file and convert recordset data into CSV format.

how to load extracted file name into sql server table in SSIS

i have 3 csv files in a folder which contains eid, ename, country fields, and my 5 csv files names are test1_20120116_034512, test1_20120116_035512,test1_20120116_035812 etc.. my requirement is I want to take lastest file based on timne stamp and modified date, which i have done. Now i want to import the extracted file name into destination table..
my destination tables contains fields like,
filepath, filename, eid, ename, country
I have posted regarding this before in the same site i got an answer for extracting filename, now i want to load the extracted FileName into destination table
Import most recent csv file to sql server in ssis
my destination tables should have output as
C:/source test1_20120116_035812 1234 tester USA
In your DataFlow task, add a Derived Column Transformation. The value of CurrentFile will be the fully qualified path to the file. As you only want the file name, I would look to use a replace function on that with the base folder and then strip the remaining slash. This does not strip the file extension but you can add yet another call to REPLACE and substitute an empty string
Derived Column Name: filename
Derived Column:
Expression: REPLACE(REPLACE(#[User::CurrentFile], #[User::RootFolder], ""), "\\", "")
The above expects it to look like
CurrentFile = "C:\source\test1_20120116_035812.csv"
RootFolder = "C:\source"
Edit
I believe you've done something in your approach that I did not do. You should see a warning about possible truncation but given the values discussed in this and the preceding question, I don't believe the 4k limit on expressions will be of concern.
Displaying the derived column
Demonstrating the derived column does work
I will give you a +1 for providing an approach I wasn't aware of, but you'll still need to add a derived column to match your provided format (base path name)
Full path is provided from the custom properties. Use the above REPLACE section to remove the path info except use the column [FileName] instead of #[User::CurrentFile]
I tried to get the filename through the procedure which Billinkc has given, but its throwing me error stating that filename column failed becaue of truncation error..
Any how i tried different approach to load file name into table.
steps i have used
1. right click on flat file Source and click on show advanced edito for Flat file
2. select component Properties tab
3. Inside that Custom Properties section ---> it has a property FileNameColumnName
I have assigned Filename to that column property like
FileNameColumnName----> FileName thats it, am able to get the filename into my destination table..