Google apps script 我试图在谷歌电子数据表上打印NSE印度网站表,但我无法得到它
我试图在谷歌电子数据表上打印NSE印度网站表,但我无法得到它。 我在范围函数中面临的问题是,我需要传递哪些示例参数才能在google电子表格中获得此表 下面是我的代码Google apps script 我试图在谷歌电子数据表上打印NSE印度网站表,但我无法得到它,google-apps-script,spreadsheet,google-sheets-api,spread,Google Apps Script,Spreadsheet,Google Sheets Api,Spread,我试图在谷歌电子数据表上打印NSE印度网站表,但我无法得到它。 我在范围函数中面临的问题是,我需要传递哪些示例参数才能在google电子表格中获得此表 下面是我的代码 var cellFunction = '=IMPORTHTML("https://www.nseindia.com/live_market/dynaContent/live_watch/option_chain/optionKeys.jsp?symbolCode=-9999&symbol=BANKNIFTY&sym
var cellFunction = '=IMPORTHTML("https://www.nseindia.com/live_market/dynaContent/live_watch/option_chain/optionKeys.jsp?symbolCode=-9999&symbol=BANKNIFTY&symbol=BANKNIFTY&instrument=OPTIDX&date=-&segmentLink=17&segmentLink=17","table")';
sheetName.getRange('1','23','80','80').setValue(cellFunction);
如果要将单元格内容设置为公式,则需要使用而不是
您还只需将公式插入单个单元格,它将自动展开表中相邻单元格中的数据
试着替换
sheetName.getRange('1','23','80','80').setValue(cellFunction);
与
一个完整的工作示例是:
function insertFormula() {
var sheet = SpreadsheetApp.getActiveSheet();
var range = sheet.getRange(1, 1); // inserts formula into A1
range.setFormula('=IMPORTHTML("https://www.nseindia.com/live_market/dynaContent/live_watch/option_chain/optionKeys.jsp?symbolCode=-9999&symbol=BANKNIFTY&symbol=BANKNIFTY&instrument=OPTIDX&date=-&segmentLink=17&segmentLink=17";"table")');
}
@PKInception必须有足够的空闲单元格来插入表,请在空白工作表中尝试。
function insertFormula() {
var sheet = SpreadsheetApp.getActiveSheet();
var range = sheet.getRange(1, 1); // inserts formula into A1
range.setFormula('=IMPORTHTML("https://www.nseindia.com/live_market/dynaContent/live_watch/option_chain/optionKeys.jsp?symbolCode=-9999&symbol=BANKNIFTY&symbol=BANKNIFTY&instrument=OPTIDX&date=-&segmentLink=17&segmentLink=17";"table")');
}