For the complete documentation index, see llms.txt. This page is also available as Markdown.

Upload.create

Upload.create([content, options]) → Promise<Upload>

Uploads data to the table, and (by default) waits for it to be imported. Uploads larger than 8MB are uploaded resumably, and automatically resume if interrupted.

await table.upload('data.csv').create(file, { skipBadRecords: true });

Parameters:

content : optional The data to upload. One of:

  • a Blob or File

  • an ArrayBuffer or typed array (e.g., a Uint8Array, or a Node.js Buffer)

  • a ReadableStream of bytes, in which case the size option is required

  • a file path (Node.js only)

  • tabular data — an array of row objects, or an arrow Table — which is uploaded as newline-delimited JSON

Omit the content when importing data with transferSpecification, or when creating a stream upload.

type : string, optional The type of the file, e.g. delimited, ndjson, parquet, avro, orc, xls, xlsx, dta, sas7bdat, sav, or stream. Inferred from the upload's name if not provided.

size : number, optional The size of the content, in bytes. Required when the content is a ReadableStream.

transferSpecification : object, optional Import the data from another source, rather than uploading content: { sourceType, sourcePath, identity }, where sourceType is one of url, gcs, s3, bigQuery, or redivis. See Uploading data.

schema : object[], optional For stream uploads, the upload's variables, as [{ name, type }]. If not provided, the schema is inferred from the first rows inserted.

metadata : object, optional Metadata for the upload's variables, keyed by variable name, as { [name]: { label, description, valueLabels } }.

hasHeaderRow : boolean, default true Whether the first row of a delimited or Excel file is a header.

skipBadRecords : boolean, default false Whether to skip rows that can't be parsed, rather than failing the upload.

delimiter, quoteCharacter, escapeCharacter : string, optional For delimited files. The delimiter is inferred if not provided.

hasQuotedNewlines : boolean, optional For delimited files, whether cells may contain newlines (within quotes). Setting this to true will substantially reduce ingest performance.

allowJaggedRows : boolean, default false For delimited files, whether to allow rows with fewer columns than the header.

nullMarkers : string[], optional Values that represent nulls (e.g., ['NA', '.']).

ifNotExists : boolean, default false If an upload with this name already exists on this version of the table, return it rather than throwing.

replaceOnConflict : boolean, default false If an upload with this name already exists, delete it and create this one in its place.

renameOnConflict : boolean, default false If an upload with this name already exists, create this one with a new name.

waitForFinish : boolean, default true Whether to wait for the data to be imported.

raiseOnFail : boolean, default true Whether to throw a JobError if the import fails.

removeOnFail : boolean, default false Whether to delete the upload if the import fails.

onProgress : function, optional Called with { bytesUploaded, totalBytes } as the content is uploaded.

signal : AbortSignal, optional

Returns: Promise<Upload>, this upload.

Was this helpful?