Google表格中的自动填充工作日

时间:2016-07-01 15:27:25

标签: date google-sheets formulas

我知道您可以找到工作日和其他返回值之间的天数,但我无法找到使用工作日或工作日公式的方法,并让它返回下一个工作日日期。我还想使用自动填充功能将其填入A列,并在单元格A1中使用硬编码的开始日期。 (周末(周六,周日除外))谢谢你的帮助!

2 个答案:

答案 0 :(得分:0)

试试这个:

// Given a URL, establishes an HttpUrlConnection and retrieves
// the web page content as a InputStream, which it returns as
// a string.

private String downloadUrl(String myurl) throws IOException {
    InputStream is = null;
    // Only display the first 500 characters of the retrieved
    // web page content.
    int len = 500;

try {
    URL url = new URL(myurl);
    HttpURLConnection conn = (HttpURLConnection) url.openConnection();
    conn.setReadTimeout(10000 /* milliseconds */);
    conn.setConnectTimeout(15000 /* milliseconds */);
    conn.setRequestMethod("GET");
    conn.setDoInput(true);
    // Starts the query
    conn.connect();
    int response = conn.getResponseCode();
    Log.d(DEBUG_TAG, "The response is: " + response);
    is = conn.getInputStream();

    // Convert the InputStream into a string
    String contentAsString = readIt(is, len);
    return contentAsString;

// Makes sure that the InputStream is closed after the app is
// finished using it.
} finally {
    if (is != null) {
        is.close();
    } 
}
}

// Reads an InputStream and converts it to a String.
public String readIt(InputStream stream, int len) throws IOException, UnsupportedEncodingException {
    Reader reader = null;
    reader = new InputStreamReader(stream, "UTF-8");        
    char[] buffer = new char[len];
    reader.read(buffer);
    return new String(buffer);
}

周日至周四增加1,周五增加3,周六增加2。

答案 1 :(得分:0)

我希望这个答案对访问此处寻找答案的其他人有所帮助。

以下为您的回答:Autofill weekdays only ...

您可以自行填写工作日,不包括周末(周六,周日),如下所示

  

A2:first date

     

A3:=A2+IF(WEEKDAY(A2)>5,3,1)

     

并填写A3。

注意:不是 = 6 只是> 5