Libreoffice export each row to 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 ?

Upvotes: 0

Views: 1238

Answers (2)

user21207655
user21207655

Reputation: 1

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

Upvotes: 0

Jim K
Jim K

Reputation: 13819

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.

Upvotes: 0

Related Questions