Created
November 18, 2024 16:26
-
-
Save devmnj/52d11c542f86ebe660bebe4f5b59b2a5 to your computer and use it in GitHub Desktop.
App script - API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function doGet(request){ | |
var doc = SpreadsheetApp.getActiveSpreadsheet(); | |
var sheet = doc.getSheetByName('Sheet1'); | |
var values = sheet.getDataRange().getValues(); | |
var output =[] | |
for(var i=1;i<values.length;i++) | |
{ | |
var row= {}; | |
row['symbol']=values[i][1]; | |
row['exchhange']=values[i][2]; | |
row['company']=values[i][3]; | |
row['open']=values[i][4]; | |
row['price']=values[i][5]; | |
row['high']=values[i][6]; | |
row['low']=values[i][7]; | |
row['change']=values[i][8]; | |
row['change%']=values[i][9]; | |
row['h52w']=values[i][10]; | |
row['l52w']=values[i][11]; | |
row['volume']=values[i][12]; | |
row['pe']=values[i][13]; | |
row['eps']=values[i][14]; | |
row['yclose']=values[i][15]; | |
row['shares']=values[i][16]; | |
row['marketcap']=values[i][17]; | |
row['volavg']=values[i][18]; | |
row['datedelay']=values[i][19]; | |
output.push(row); | |
} | |
var retObj = ContentService.createTextOutput(JSON.stringify({data:output})).setMimeType(ContentService.MimeType.JSON) | |
// Logger.log(output) | |
return retObj | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment