SheetFast API reference
On this page
Authentication
Sheetfast uses API keys to allow access to the API. You can get an API key by creating one in the settings tab in Sheetfast.
Sheetfast expects the API key to be included in all API requests to the server in a header that looks like the following:
Authorization: Bearer SECRET_KEY
All API requests on Sheetfast are scoped to a Project.
Generate a file
Method
POST https://api.sheetfast.com/generate
Headers
Content-Type: application/json
Authorization: Bearer API_KEY
Body
The request body is a JSON object with two main keys: options
and sheets
.
Options
The options
key contains a JSON object with various options for the file generation and upload.
Key | Type | Default | Sheet option | Description |
---|---|---|---|---|
headers | object | {} | ✅ Yes | Custom headers to be included in the file. The key is the header name and the value is the header value. |
formatters | object | {} | ✅ Yes | Custom formatters to be applied to the data. The key is the data field name and the value is the formatter function. See Formatters. |
subRowColumns | string[] | [] | ✅ Yes | Columns to split into multiple rows. For each input row, every of these columns must contain arrays of equal length. |
subRowDroppedColumns | string[] | [] | ✅ Yes | If using subRowColumns , columns for which values must not be duplicated across subrows. |
removeHeaderRow | boolean | false | ❌ No | If true , the first row of the data will be treated as the header row and will be removed from the data. |
decimalSeparatorComma | boolean | false | ❌ No | If true , the decimal separator in the data will be a comma (, ) instead of a period (. ). |
CSVDelimiter | string | ',' | ❌ No | The delimiter to be used in the CSV files. |
CSVRowDelimiter | string | '\n' | ❌ No | The row delimiter to be used in the CSV files. |
filename | string | 'export-<TIME_NS>' | ❌ No | The filename for the generated files. The default value is a dynamic filename with the current timestamp. |
noXlsx | boolean | false | ❌ No | If true , the XLSX file will not be generated. |
CSVExtension | string | 'csv' | ❌ No | The file extension for the CSV files. |
forceZip | boolean | 'false' | ❌ No | the csv key will point to a compressed ZIP file containing the individual CSV files for each sheet. |
contentDisposition | string | 'attachment' | ❌ No | The content disposition of the file uploaded in the bucket. |
Sheet data
Key | Type | Default | Description |
---|---|---|---|
rows | object[] | ❌ Required | An array of objects, where each object is a row of data for the file. The data key contains an array of objects, where each object is a row of data for the file. The keys in the objects are the column names for the file, and the values are the data for the columns. |
name | string | 'Sheet {i+1}' | The sheet name. If already used, a number will be appended. Make sure the name you entered does not exceed 30 characters and does not contain any of the following characters: : \ / ? \* [ or ] |
options | object | {} | Sheet-bound options. See Options. |
Column order
The columns follow the order given by the headers
option. Any other column will be appended after, sorted in alphabetical order.
Formatters
Formatter | Arguments | Description |
---|---|---|
json | Keep the value as-is, without splitting it in multiple columns. | |
date::arg | arg (string ): Python datetime format | Format a date. Available codes: https://docs.python.org/3/library/datetime.html#strftime-and-strptime-format-codes |
devise::cents | Divide the input number by 100. |
Response
The response is a JSON object with two keys: csv
and xlsx
. The values for these keys are the URLs and ObjectKey for the generated CSV and XLSX files, respectively. If noXlsx
is true
, the xlsx
key will not be present in the response.
The key key
is the ObjectKey for the generated file in the bucket. Is useful if you want to download the file later, or if you want to delete it immediately after the file is downloaded.
Example
{
"csv": {
"key": "1715351964513062365/export-1715351964493862473.csv",
"url": "https://your-own-bucket.url/1715351964513062365/export-1715351964493862473.csv?AWSAccessKeyId=DO003ANE2UHTLZ8NEME8&Signature=ZOHQlNZldfHN6Tlf%2BEF4tInkjEs%3D&Expires=1719866878"
},
"xlsx": {
"key": "1715351964513062365/export-1715351964493862473.xlsx",
"url": "https://your-own-bucket.url/1715351964513062365/export-1715351964493862473.xlsx?AWSAccessKeyId=DO003ANE2UHTLZ8NEME8&Signature=zmROfxGnsy07cGOq1jQ%2B8bIeAsI%3D&Expires=1719866878"
}
}
Reasons Why CSV is a Zip
If forceZip
is true
, the CSV file is larger than 10MB, or there are multiple sheets, the csv
key will point to a compressed ZIP file containing the individual CSV files for each sheet.
Condition | Result |
---|---|
options.forceZip is true | Points to a compressed ZIP file containing CSV files |
Generated CSV file is larger than 10MB | Points to a compressed ZIP file containing CSV files |
There are multiple sheets | Points to a compressed ZIP file containing CSV files |
{
"csv": "https://byob.url/171xxxx53/export-1715351964493862473.zip",
"xlsx": "https://byob.url/171xxxx53/export-1715351964493862473.xlsx"
}