search
Searching...
functions
Formulas
menu_book
Pages
manage_search
Content Match
search_off
No results for ""
Sheet Read / Write
Only four TD.Sheet methods are available. Do not use or invent any others (Rule 9). All four are async — always await them.
Write a single cell — TD.Sheet.setCell
await TD.Sheet.setCell(cellIndex, value);
// Example
await TD.Sheet.setCell("A1", data[0]);
Write a range — TD.Sheet.setCellRange
Writes an array starting from startCell, filling across columns (A, B, C...). This is the method used to dump header rows and data rows from Historical, Analytics, and Option Chain responses.
await TD.Sheet.setCellRange(startCell, dataArray);
// Example — fills A1, B1, C1, ... one cell per array item
await TD.Sheet.setCellRange("A1", data);
Read a single cell — TD.Sheet.getCell
const value = await TD.Sheet.getCell(cellIndex);
// Example
const cellValue = await TD.Sheet.getCell("A1");
Read a range — TD.Sheet.getCellRange
const values = await TD.Sheet.getCellRange(startCell, endCell);
// Example
const values = await TD.Sheet.getCellRange("A1", "C1");
// Response: ["RELIANCE", "NIFTY"]
Complete Examples — Touchline to Sheet
Using setCell
const SYMBOLS = ["NIFTY"];
TD.onStart = async () => {
try {
const response = await TD.Feed.addSymbols(SYMBOLS);
if (!response.success) throw new Error(response.message);
const data = response.symbollist[0];
await TD.Sheet.setCell("A1", data[0]); // Symbol name
await TD.Sheet.setCell("B1", data[1]); // Symbol ID
await TD.Sheet.setCell("C1", data[2]); // Last Update Time
await TD.Sheet.setCell("D1", data[3]); // LTP (string — parse for math)
} catch (err) {
TD.log("Error: " + err.message);
}
};
TD.onStop = async () => {
await TD.Feed.removeSymbols(SYMBOLS);
};
TD.onError = (error) => {
TD.log(error);
};
Using setCellRange
const SYMBOLS = ["NIFTY"];
TD.onStart = async () => {
try {
const response = await TD.Feed.addSymbols(SYMBOLS);
if (!response.success) throw new Error(response.message);
const data = response.symbollist[0];
await TD.Sheet.setCellRange("A1", data);
// writes all 18 touchline fields across row 1
} catch (err) {
TD.log("Error: " + err.message);
}
};
TD.onStop = async () => {
await TD.Feed.removeSymbols(SYMBOLS);
};
TD.onError = (error) => {
TD.log(error);
};
Touchline Field Map — symbollist row
All values are strings. Use
parseFloat() for numeric fields. This is the field map for the addSymbols response row — different from the tick event's field order, which is documented on Live Events.| Index | Field |
|---|---|
0 |
Symbol name |
1 |
Symbol ID |
2 |
Last Update Time |
3 |
LTP (Last Trade Price) |
4 |
Tick Volume |
5 |
Average Traded Price |
6 |
Total Volume |
7 |
Open |
8 |
High |
9 |
Low |
10 |
Previous Close |
11 |
Today's Open Interest |
12 |
Previous OI Close |
13 |
Turnover |
14 |
Bid |
15 |
Bid Quantity |
16 |
Ask |
17 |
Ask Quantity |
Empowering traders and analysts with high-performance real-time market data directly within their spreadsheets.
Resources
Support
© 2026 TrueData Market Data Services LLP. All rights reserved.