How to Convert Excel (97–2003) to CSV in Ruby

Outdated file formats can be a difficult roadblock when it comes to sharing or manipulating the contents of the files. One way to remove this roadblock is converting to another, more convenient format, such as CSV. Since conversions themselves can be complicated as well, we will be showing you how to automatically convert an Excel (97–2003) file to CSV in Ruby.

We will start by adding the Ruby client to the Gemfile:

gem 'cloudmersive-convert-api-client', '~> 2.1.6'

After this, we can input the file and API key into the following code to call the ConvertDocumentXLStoCSV function:

# load the gem
require 'cloudmersive-convert-api-client'
# setup authorization
CloudmersiveConvertApiClient.configure do |config|
# Configure API key authorization: Apikey
config.api_key['Apikey'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
#config.api_key_prefix['Apikey'] = 'Bearer'
end

Your new CSV file will be available at the end of this short process! If you need to obtain an API key, register for a free account on the Cloudmersive website; this provides 800 calls/month across our library of APIs.

--

--

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Cloudmersive

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.