Integrating the GoodGrids API with a python application is simple. You can create an Excel file from a CSV file with this simple snippet of code:
import requests
from six import BytesIO
def create_excel_file(csv_content):
"""
Creates an Excel file from CSV text content
:param csv_content: a string containing the contents of a CSV file
:return: Binary contents of an Excel file, as bytes
"""
goodgrids_api_url = 'https://api.goodgrids.com/api/convert/v1/csv-to-excel/3a6c0d9ac7c74d'
response = requests.post(
url=goodgrids_api_url,
files={
'file': BytesIO(csv_content),
}
)
return response.content
Make sure to set goodgrids_api_url
to your actual API URL.
This code is compatible with both python 2 and python 3.
Found a bug? Have a suggestion on how to improve this documentation? Please send us a note at support@goodgrids.com.