我正在使用IMPORTDATA从API导入数据。
例如=IMPORTDATA("https://api.bitcoinaverage.com/ticker/EUR/")
不幸的是,每次打开电子表格时都必须单击单元格以从API获取新数据。 有没有办法让电子表格每小时左右刷新一次以获取新数据?
答案 0 :(得分:1)
如果您不想要任何脚本,那么您可以转到电子表格 - > 文件 - > 电子表格设置 - > 计算然后将其设为public class SignUpPresenter {
private SignUpFragment fragment;
public String token = "token";
SharedPreferences sharedpreferences;
private Context mContext;
public static final String MyPREFERENCES = "MyPrefs" ;
public SignUpPresenter(SignUpFragment fragment) {
this.fragment = fragment;
}
public SignUpRequest constructSignUpRequest() {
SignUpRequest request = new SignUpRequest();
request.setName(getAndTrimValueFromEditText(fragment.etName));
request.setEmail(getAndTrimValueFromEditText(fragment.etEmail));
request.setMobile(getAndTrimValueFromEditText(fragment.etPhone));
return request;
}
private String getAndTrimValueFromEditText(EditText e) {
return e.getText().toString().trim();
}
public SharedPreferences getSharedPreferences() {
return sharedpreferences;
}
void signup (){
this.register(constructSignUpRequest());
}
void register(final SignUpRequest signUpRequest) {
fragment.showProgressDialog(fragment.loading);
fragment.getApi().regsiterCustomer(constructSignUpRequest())
.observeOn(AndroidSchedulers.mainThread())
.subscribeOn(Schedulers.io())
.subscribe(new Observer<GenericResponse>() {
@Override
public void onCompleted() {
}
@Override
public void onError(Throwable e) {
fragment.dismissProgressDialog();
Timber.e(e.getLocalizedMessage());
Toast.makeText(fragment.getContext(), fragment.connectionError, Toast.LENGTH_SHORT).show();
}
@Override
public void onNext(GenericResponse signUpResponse) {
fragment.dismissProgressDialog();
Toast.makeText(fragment.getContext(), signUpResponse.getInfo(), Toast.LENGTH_SHORT).show();
if (signUpResponse.getCode() == fragment.successCode) {
/*fragment.gotoActivationCodeActivity(SignUpRequest.getEmail(), SignUpRequest.get());*/
fragment.gotoQuestionActivity(signUpRequest.getEmail(), signUpRequest.getName(), signUpRequest.getMobile());
SharedPreferences.Editor editor = sharedpreferences.edit();
editor.putString(token, signUpResponse.getData().getToken());
editor.commit();
}
}
});
}
}
。
有关详细信息,请查看此page。
希望它对你有所帮助。