Jump to content

Convert CSV to XLSX

Recommended Posts

Convert CSV to XLSX

Download URL: https://github.com/bpetrynski/alfred-convert-csv-to-xslx/


This is an Alfred Workflow that lets you convert CSV files to XSLX (Excel) format. This tool is very useful for data analysts or anyone who frequently works with data files and needs to convert them to a more user-friendly format for editing and visualization purposes.

The conversion process is done by a Python script which reads a CSV file, converts it into a DataFrame (a two-dimensional tabular data structure with labeled axes), and then writes that DataFrame into an XLSX (Excel) file.


Step 1: Install Python (if not already installed):

Open Terminal and type:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install python

Step 2: Install the required Python libraries:

We'll need two libraries: pandas for data manipulation and openpyxl for Excel file handling.

To install these libraries, type the following command in Terminal:

pip install pandas openpyxl


Use via Universal Actions in Alfred. Alfred's Universal Actions allow you to select a file in Finder or on your Desktop and apply an action to it, like converting the file format.

In Environment Variables you can change the default encoding, delimiter, and quote character.



  • Added conversion parameters as variables: This enhancement allows you to set specific parameters for the conversion process as variables, giving you more control over the output.


  • Added autofiltering: This feature automatically applies filters to the columns in the Excel file, making it easier for you to sort and filter the data.
  • Added freezing of the top row: Freezing the top row allows you to scroll down in the Excel file without losing sight of the column headers.


  • Initial version: Basic CSV to XSLX conversion functionality.
Link to comment

Welcome @bartoszpet,


Looking good. A few tips for the workflow, which will make it more resilient and avoid a few issues:

  • You don’t need to export PATH to add the Homebrew paths, Alfred includes those.
  • Always prefer with input as argv over with input as {query}. As it is, your script will fail with certain file names.
  • It’s common practice to bundle the libraries with the workflow. To include a Python package with the workflow, use the --target option and set PYTHONPATH. StackOverflow has other options. Always make sure to install with /usr/bin/python3 so packages are built with the system python.
  • This is more of a question, but how’s the Keyword supposed to work? It doesn’t take an argument but the script seems to require a path.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...