0

I'm looking for a way to automate XLSX to CSV conversion. Ideally, I would also like to add column names that are not yet in the XLSX.

For now, I'm using CSVkit/In2CSV. This works, but I still have to enter the name of the file manually. In terminal, I now do this:

in2csv /Users/file.xslx -f xlsx -I > file.csv

I would like to be able to automate this, so that when I open the script, it asks me for the location of the file (or I just drag the file to the script), and then it automatically converts. I have looked into AppleScript, but can't really seem to figure it out, must probably be very easy. How can I automate this? I'm on a Mac.

  • Why did you use the `python` tag if you want an Applescript solution? The libraries you use don't do what you want anyway. A quick&dirty solution would be to use Pandas to read the CSV into a dataframe with `df=pd.read_csv(somePath)` and write it out to an Excel file with `df.to_excel('somefile.xlsx')` – Panagiotis Kanavos May 09 '22 at 11:07
  • Does this answer your question? [Python convert csv to xlsx](https://stackoverflow.com/questions/17684610/python-convert-csv-to-xlsx) – Panagiotis Kanavos May 09 '22 at 11:08
  • You are correct, I have deleted the tag, as I'm not familiar to Python and it will probably complicate things. Do you have any idea how to do this with AppleScript? – Christiaan May 10 '22 at 12:07

0 Answers0