bradjasper / ImportJSON

Import JSON into Google Sheets, this library adds various ImportJSON functions to your spreadsheet

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Total noob here. I can't figure out how to remove headers from the data I am pulling from Yahoo Finance.

rbrowne64 opened this issue · comments

Hello all,

First of all, thank you to Brad and Tommy and the rest of the contributors for making such a useful script. It will be hugely helpful to me once I have learned how to make it run best for me.

So right now, I have the script pulling yahoo finance data from stock tickers in my google spreadsheet. It does as advertised and returns the data. However, it returns a header row and then two duplicate rows of data underneath. I need to remove the header row and the duplicate row. I've tried inputting the "noHeaders" option to remove the header but it causes the script to error out.

Also, I need the script to be able to be dragged down a column to autogenerate the data for the rest of the tickers and future tickers in my spreadsheet.

My function looks like this:

=ImportJSON("https://query2.finance.yahoo.com/v10/finance/quoteSummary/"&D3&"?modules=defaultKeyStatistics")

I've tried to add in the "noHeaders" option like this:

=ImportJSON("https://query2.finance.yahoo.com/v10/finance/quoteSummary/"&D3&"?modules=defaultKeyStatistics", "noHeaders")

but it ruins the script.

I've tried to understand what I am looking at when I'm reading the code and I'm absolutely lost.

I would appreciate if anyone could help me work through this.

Thanks,

Ryan

You need to follow the method signature like so the second option should be an empty string "" and use semicolons instead of commas between the params
=ImportJSON("https://query2.finance.yahoo.com/v10/finance/quoteSummary/&D3&?modules=defaultKeyStatistics"; ""; "noHeaders")

Anyway your URL does not load any data, better check it.

Thanks, Lucas! That did the trick! However, I am still getting a duplicate row below the output row. Any idea on how to fix that?

And the D3 hidden in my URL is a reference to a cell with a ticker so it pulls data from the ticker in the reference cells.

Thanks again