I have this link with a lot of info:
https://steamcommunity.com/market/pricehistory/?currency=1&appid=570&market_hash_name=Exalted%20Fractal%20Horns%20of%20Inner%20Abysm
I want to import all the data to a google sheet
I am using IMPORTDATA Function but I think it doesn't support all the lenght of the data.
This is the code:
=IMPORTDATA("https://steamcommunity.com/market/pricehistory/?currency=1&appid=570&market_hash_name=Fractal%20Horns%20of%20Inner%20Abysm")
I am getting this error:
Error Could not fetch url: https://steamcommunity.com/market/pricehistory/?currency=1&appid=570&market_hash_name=Fractal%20Horns%20of%20Inner%20Abysm
Related
How can I fix this import data?
I imported data from matomo.com and I get data but with some errors in data like (�) and I can't use any other function.
How can I clean this data that I imported to use for my google sheet?
try removing �:
=SUBSTITUTE(A4; "�"; )
for the whole array:
=INDEX(SUBSTITUTE(A:A; "�"; ))
i'm Using Google Sheets with IMPORTXML to scrape a download count information from a japanese website via XPath in google sheet. I want to save the number/text inside this red box
here's the link
https://www.photo-ac.com/main/detail/4465781?title=%E3%82%A2%E3%82%B2%E3%83%8F%E8%9D%B6%E3%81%A8%E3%83%92%E3%83%A3%E3%82%AF%E3%83%8B%E3%83%81%E3%82%BD%E3%82%A6
here's my function
=IMPORTXML("https://www.photo-ac.com/main/detail/4465781?title=アゲハ蝶とヒャクニチソウ", "/html/body/div[17]/div/div/div/div[2]/div[7]/div[1]/div[1]/div/div[3]/div[2]/div[1]//text()")
the function doesn't work? why?
thank you
When I tested your formula, I confirmed that an error of Could not fetch url: occurred. But, fortunately, when Google Apps Script is used, I confirmed that the URL can be requested using UrlFetchApp. So, in this answer, I would like to propose to use Google Apps Script. The sample script is as follows.
Sample script:
Please copy and paste the following script to the script editor of Google Spreadsheet, and save it, and put a formula of =SAMPLE("URL") to a cell. If the function name is not found, please reopen the Google Spreadsheet and test it again. This script is used as the custom function.
function SAMPLE(url) {
const value = UrlFetchApp.fetch(url).getContentText().match(/ダウンロード:.+/);
if (!value) throw new Error("Value was not retrieved.");
return value;
}
Result:
When above script is used, the following result is obtained.
Note:
This sample script is for the current HTML of the URL of https://www.photo-ac.com/main/detail/4465781?title=アゲハ蝶とヒャクニチソウ. And, when the structure of HTML of the URL is changed, above script might not be able to be used. Please be careful this.
References:
Custom Functions in Google Sheets
fetch(url)
We can list out spreadsheet present in google drive using below command
from google.colab import drive
drive.mount('/content/drive')
!ls -l /content/drive/'Shared drives'
but unable to read spreadsheet using below command
import gspread
from oauth2client.client import GoogleCredentials
gc = gspread.authorize(GoogleCredentials.get_application_default())
gc.open('/content/drive/'Shared drives/data.gsheet').data available
and also one more problem we have space in sheetname(data available) and we don't have access to change sheetname
I have refer link:: https://colab.research.google.com/notebooks/io.ipynb
Kindly help on it.
You can use gc.open_by_url('gsheets_url') to open the document (no need to mount the drive). For the sheet name, you can use gsheets.worksheet('sheet name').
So on your case it'd go something like:
from google.colab import auth
auth.authenticate_user()
import gspread
from oauth2client.client import GoogleCredentials
# setup
gc = gspread.authorize(GoogleCredentials.get_application_default())
# read data and put it in a dataframe
gsheets = gc.open_by_url('your-link')
sheets = gsheets.worksheet('data available').get_all_values()
df = pd.DataFrame(sheets[1:], columns=sheets[0])
(credits to this post)
Update to the answer by Murilo Cunha, as it gives errors for authentication
from google.colab import auth
auth.authenticate_user()
import gspread
from google.auth import default
creds, _ = default()
gc = gspread.authorize(creds)
import pandas as pd
# read data and put it in a dataframe
gsheets = gc.open_by_url('Your link')
sheets = gsheets.worksheet('data available').get_all_values()
df = pd.DataFrame(sheets[1:], columns=sheets[0])
It's helpful if you could say what is the exact error you get when you run this script. However, I notice there are redundant quotes in following script,
gc.open('/content/drive/'Shared drives/data.gsheet')
replace extra above by following,
gc.open('/content/drive/Shared drives/data.gsheet')
Another option is to try gc.open_by_url() instead of gc.open()
I need to fetch the closing price of given stock at specified dates from Yahoo Finance API. However, there does not seem to be any good documentation on how to achieve this.
Install the following packages:
pandas_datareader
fix_yahoo_finance
Example script:
import pandas_datareader.data as web
import fix_yahoo_finance as yf
yf.pdr_override()
print(web.get_data_yahoo('AAPL', start="2018-01-01", end="2018-01-07"))
I'm trying to scrape this link using Jsoup with Kotlin/Java. And I have problem in scrapping players part (under Current Squad). Could anyone parse it?
You can not access the information directly using only the response from that link.
You can make a JSON object with the http response from https://stats.fn.sportradar.com/betsgi/en/America:Argentina:Buenos_Aires/gismo/stats_team_squad/2817 and https://stats.fn.sportradar.com/betsgi/en/America:Argentina:Buenos_Aires/gismo/stats_teamplayer_facts/2817/42556.
As an example in python you can get the minutes played by each player as follows:
import urllib
import json
f=urllib.urlopen('https://stats.fn.sportradar.com/betsgi/en/America:Argentina:Buenos_Aires/gismo/stats_team_squad/2817')
f2=urllib.urlopen('https://stats.fn.sportradar.com/betsgi/en/America:Argentina:Buenos_Aires/gismo/stats_teamplayer_facts/2817/42556')
j=json.loads(f.read())
j2=json.loads(f2.read())
plrs=j['doc'][0]['data']['players']
for plr in plrs:
print '========================='
print plr['name']
try:
print 'minutes played:' +str(j2['doc'][0]['data'][str(plr['_id'])]['stats']['total']['minutes_played'])
except KeyError, e:
pass