I know that sample standard deviation and population standard deviation are different, and are used in different cases (first when N>>n, second when N=n). But what when N>n, although not by much? For example, n=7 and N=30. I guess none of these two would be appropriate, but is there another formula for such cases? Or at least a rule of thumb saying which of these two would be more correct?
The standard deviation is defined as the square root of the variance which, in turn, can be calculated for the entire population or for a sample of the population. When the population variance cannot be calculated directly, a different formula (dividing the sum of squared deviations from the mean by n-1, instead of by n) can be used to calculate an unbiased estimator of variance for the population based on data from the sample.
In your case it does not appear necessary to estimate the population variance since you can calculate it directly. And whether you report the standard deviation for the whole population or for a subsample, depends on what you want to describe.