Sign Up
Loading...

Advanced file commands

Prepare CSV downloads, work with small ZIP archives and share a temporary download link from an endpoint, server function or event. Find these commands under File Manager when adding a command. Use the usual variable selector and Return as field.

The existing file commands still handle storage, folders, permissions and ordinary text files. See Managing Files.

Choose a file with readable contents

Read CSV and ZIP commands need the file's contents. Use an uploaded file input, a file returned by another command, or Get File with Include bytes enabled for a stored file. A path or ordinary file listing alone does not contain the contents to read.

Read CSV

Choose file. Leave delimiter as a comma for ordinary CSV, or choose a semicolon, tab or pipe. has_header is true by default: the first row supplies the column names.

The result contains:

  • headers: the column names, or an empty list when has_header is false.

  • rows: a list of objects when headers are present, or lists of cell values when they are absent.

  • row_count: the number of data rows, excluding the header.

For a file containing name,quantity followed by Tea,2, the first row object has name set to Tea and quantity set to the text 2. Convert a cell to a number later when needed.

Quoted cells can contain delimiters, quotation marks or multiple lines. Files must use UTF-8 text, have a consistent number of columns and contain unique, nonempty headers. An empty file returns empty headers and rows with a count of zero.

Create CSV

Choose rows, a list of objects such as products or orders. Optionally provide columns, a list of field names in the order you want. Without columns, object rows use the first object's fields. Nested objects and lists are not supported as cells; use a list transformation to select simple values first.

Leave include_header enabled to write the column names and choose the delimiter you need. The command returns CSV text. Pass that text to Upload file, choose a filename ending in .csv and set its content type to text/csv to store it.

safe_for_spreadsheets is enabled by default. Text that looks like a spreadsheet formula is prefixed with an apostrophe so opening the download does not execute that formula. Keep this protection enabled for customer-provided text. Disable it only when the receiving application specifically requires the original text and you have reviewed that data.

Read and Create CSV support up to 10,000 data rows and 100 columns. Read CSV accepts files up to 1 MiB. Generated results are also bounded; large exports should be split into smaller files.

Create ZIP

Choose files, a list of objects. Each object has:

  • name: the filename inside the archive, for example reports/orders.csv.

  • file: a file value with readable contents.

The result is a file value for archive.zip. Save it using Upload file if you want to keep it, or use it in later file commands. Creating the archive does not save it automatically.

Include between 1 and 100 files, using distinct names. Folder paths inside the ZIP may organize the entries, but cannot point outside the archive. Names that differ only by letter case count as duplicates.

List ZIP entries

Choose file to inspect an archive without extracting files. The result lists each entry's name, size, compressed_size and is_directory.

Use this to display the available files or find the entry you want before reading it.

Read ZIP entry

Choose the archive file and the exact entry name from List ZIP entries, such as reports/orders.csv. The result is a file value containing that entry's contents. Pass it to Read CSV or Read Text File, or save it with Upload file.

These commands inspect or read entries without extracting an archive into folders. They reject unsafe paths, links, encrypted archives, ZIP64 archives and unsupported archive formats. Both the archive and its total expanded contents are limited to 1 MiB, with up to 100 entries. Very highly compressed archives may also be rejected. Split larger archives into smaller files.

Useful checks

Test with a small sample before exporting customer data. Check the file's contents, filename and permissions. If Read CSV reports a column mismatch, inspect quoted cells and the selected delimiter. If a ZIP entry is not found, copy its exact name from List ZIP entries.

These additions run in server workflows. They do not change stored files or existing database records unless a later command explicitly saves something.

Related Topics

Variables

Variables are essential building blocks in Twidget that allow you to store and manipulate data dynamically within your no-code applications. They enable you to create flexible and interactive applications by holding values that can be changed and referenced throughout your workflow. Creating Variabl...

Page Security

Use these commands in page workflows to check reCAPTCHA before accepting a form submission. Configure your keys first; see [Page Settings](/docs/pages/page-settings) and the existing [reCAPTCHA guide](/docs/pages/recaptcha). Generate reCAPTCHA token. Generates a token for the current interaction. Th...

Miscellaneous

Twidget provides several miscellaneous commands to facilitate various tasks. Is Null. Description: Checks whether the provided value is null or not. Inputs: - value: The value to be checked. Output: - boolean: Returns `true` if the value is null; otherwise, returns `false`. Not Null. Description: Ch...

Send Message

Send SMS Command. With Twidget, you can send SMS messages to phones using the `Send SMS` command. This functionality varies depending on the provider. Currently, we support Twilio as the SMS provider. To use Twilio for SMS integrations, you will need: - A Twilio account ID - Twilio Auth Token - A Tw...

Managing Files

Twidget offers a set of commands to manipulate files in your file store. Below are the descriptions and usage of each command to help you understand how to utilize them effectively. For CSV, ZIP archives and temporary download links, see [Advanced file commands](/docs/commands/advanced-files). Get F...